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

建议使用的浏览器:

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

5390:tree

题目描述
Given a rooted tree(node 1 is the root) with $n$ nodes. The $i^{th}$node has a positive value $v_i$ at beginning.
We define the universal set $S$ includes all nodes.
There are two types of Memphis's operation.
First, Memphis may change the value of one node. It's the first type operation:
$$0~~u~~v~~~(u\in S,0\leq v\leq 10^9)$$
What's more, Memphis wants to know what's the maxinum of $v_u\otimes v_t(t\in path(u,root),\otimes~~means~~xor)$ . It's the second type operation:
$$1~~u~~~(u\in S)$$
输入解释
This problem has multi test cases(no more than $3$).
The first line contains a single integer $T$, which denotes the number of test cases.
For each test case,the first line contains two non-negative integer $n,m(1\leq n,m\leq 100000)$ - the number of nodes and operations.
The second line contains $n-1$ non-negative integer $f_2\sim f_n(f_i < i)$ - the father of $i^{th}$node.
The third line contains $n$ non-negative integer $v_1\sim v_n(0\leq v_i \leq 10^9)$ - the value of nodes at beginning.
Follow $m$ lines describe each operation.
输出解释
For each test cases,for each second operation print a non-negative integer.
输入样例
1
10 10
1 1 2 2 3 1 2 3 5
23512 460943 835901 491571 399045 97756 413210 800843 283274 106134
0 7 369164
0 7 296167
0 6 488033
0 7 187367
0 9 734984
1 6
0 5 329287
1 5
0 7 798656
1 10
输出样例
766812
351647
431641
来自杭电HDUOJ的附加信息
Author SXYZ
Recommend wange2014

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

源链接: HDU-5390

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

共提交 0

通过率 --%
时间上限 内存上限
16000/8000MS(Java/Others) 262144/262144K(Java/Others)