Answering Queries on a Tree
题意翻译
有 $n$ 个节点的树,$m$ 个操作。每个节点有颜色 $C_i$。
操作类型为:
`0 u c`,把 $C_u$ 改为 $c$。
`1 u v`,询问 $u,v$ 路径间出现最多颜色的次数。
$T$ 组数据,每组数据先输入 $n,m$,第二行为 $C_1\sim C_n$,接下来 $n-1$ 行为树边,再接下来 $m$ 行为操作。
$T,C_i,c\le 10$,$n,m\le 10^5$。
题目描述
[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=279&page=show_problem&problem=3855
[PDF](https://uva.onlinejudge.org/external/124/p12424.pdf)
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12424/1b3a5f94e89f9dd72ac60f9c6e6cf8de4ab36c4f.png)
输入输出格式
输入格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12424/dec15e600d9e6dc17fa6033350a89f6d08ccb71d.png)
输出格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12424/e9276e7d5b2e67f968aeab0f7e2c4f7fd2140c25.png)
输入输出样例
输入样例 #1
2
5 6
3 2 1 2 3
1 2
2 3
2 4
1 5
1 3 5
0 1 1
0 2 1
1 3 5
0 2 4
1 2 4
2 1
5 6
1 2
1 2 2
输出样例 #1
2
3
1
1