#P4060. [Code+#1] 可做题
[Code+#1] 可做题
Description
qmqmqm wants to give sublinekelzrip a doable problem. So he came up with this: given a non-negative integer sequence of length , you need to compute its prefix XOR , defined by .
However, due to a bug in the data generator, the sequence is very long, and because of insufficient memory, some were lost; only the elements at positions are known. Now qmqmqm asks you to, based on the remaining , compute the minimum possible value of among the sequences corresponding to all possible sequences consistent with the known entries.
Input Format
The first line contains two non-negative integers , denoting the length of the original sequence and the number of remaining known elements.
Then follow lines. Each line contains two numbers , indicating the position and value of a known element.
Output Format
Output a single integer denoting the minimum possible value.
5 3
4 0
3 7
5 0
7
Hint
Sample Explanation
The known sequence is , where means the entry is missing. One possible is , whose corresponding is , and the minimum sum is . It can be proven that there is no smaller case.
| Test point ID | Known | ||
|---|---|---|---|
| ^ | |||
| ^ | ^ | ^ | |
| ^ | ^ | ||
| ^ | |||
| ^ | ^ | ^ | |
| ^ | |||
| ^ | ^ | ||
| ^ | |||
Note that unknown can exceed the range of the known .
It is guaranteed that all in the input are distinct and satisfy .
From CodePlus 2017 November Contest, produced with honor by the Tsinghua University Department of Computer Science and Technology Student Algorithm and Competition Association.
Credit: idea/Lu Zhengrong, problem setter/Lu Zhengrong, tester/He Haotian.
Git Repo: https://git.thusaac.org/publish/CodePlus201711.
Thanks to Tencent for supporting this contest.
Translated by ChatGPT 5
京公网安备 11011102002149号