当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6193:Yuno And Irotoridori no Sekai

题目描述
Yuno is playing a galgame called Irotoridori no Sekai.
It's a good game, so she decided to make a data structure problem for you.
You are given a tree with $n$ nodes, each node has a value.
You need to perform three operations:
$1~x~y$ : reverse all the value of nodes on the chain $x$ -> $y$
$2~x~y~z$ : add $z$ to the value of nodes on the chain $x$ -> $y$
$3~x~y$ Then followed by $y$ numbers $v_1,v_2, ... v_y$ : output the $v_1$th, $v_2$th, ... , $v_y$th smallest value of the nodes which distance on the tree is no more than $1$ from node $x$
输入解释
First line contains two numbers $n,m$.
Second line $n$ numbers indicating the value of the first node to the last node.
The next $n - 1$ lines, every line consists of two numbers $x,y$, indicating that there exists an edge between node $x$ and node $y$.
In the next $m$ lines, every line consists of an operation described above.
输出解释
For each query, output a number indicating the answer.
输入样例
5 5
1 2 3 4 5
1 2
2 3
3 4
4 5
3 1 2 1 2
3 2 3 1 2 3
3 3 4 1 2 3 4
3 4 2 1 2
3 5 2 1 2
输出样例
1
2
1
2
3
2
3
4
5
3
4
3
5
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6193

最后修改于 2020-10-25T23:29:11+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 327680/327680K(Java/Others)