#P6569. [NOI Online #3 提高组] 魔法值
[NOI Online #3 提高组] 魔法值
Problem Description
The transportation system of Country H consists of cities and roads. Both cities and roads are numbered starting from , and City is the capital of Country H. In Country H, each road directly connects two different cities, and there is at most one road between any two cities.
Country H is a nation that believes in magic. On day , the magic value of City is . The wizards of Country H have observed the magic values of all cities on day . They also found that on each following day, the magic value of every city will become the XOR of the previous day's magic values of all cities directly connected to it, that is,
$$f_{x,j}=f_{v_1,j-1}\oplus f_{v_2,j-1}\oplus \cdots\oplus f_{v_k,j-1}$$where , are all cities directly connected to City , and denotes the XOR operation.
Now the king of Country H asks you questions. For the -th question (), you need to answer: what is the magic value of the capital on day .
Input Format
The first line contains three integers separated by spaces, representing the number of cities, the number of roads, and the number of questions.
The second line contains integers separated by spaces, where the -th integer represents .
The next lines each contain two positive integers separated by spaces, indicating a road connecting City and City .
The next lines each contain one integer. The integer on the -th line represents .
Output Format
Output lines in order, each containing one integer, representing the answer to the corresponding question.
3 3 1
0 0 1
1 2
1 3
2 3
1
1
Hint
Constraints
- For of the testdata, .
- For of the testdata, .
- Another of the testdata satisfies .
- For of the testdata, , , , .
Notes
data provider: @一扶苏一. If there are issues with the data, please contact her. If it gets accepted by a naive fast exponentiation solution, please also contact her.
Translated by ChatGPT 5