|
||||||||||
treeTime Limit: 16000/8000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 630 Accepted Submission(s): 201 Problem Description 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)$$ Input 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. Output For each test cases,for each second operation print a non-negative integer. Sample Input
Sample Output
Author SXYZ Source | ||||||||||
|