A14878 | 388535 (Easy Version)
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
This is the easy version of the problem. The difference in the constraints between both versions is colored below in red. You can make hacks only if all versions of the problem are solved.
Marin and Gojou are playing hide-and-seek with an array.
Gojou initially performs the following steps:
- First, Gojou chooses $2$ integers $l$ and $r$ such that $l \leq r$ .
- Then, Gojou makes an array $a$ of length $r-l+1$ which is a permutation of the array $[l,l+1,\ldots,r]$ .
- Finally, Gojou chooses a secret integer $x$ and sets $a_i$ to $a_i \oplus x$ for all $i$ (where $\oplus$ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)).
Marin is then given the values of $l,r$ and the final array $a$ . She needs to find the secret integer $x$ to win. Can you help her?
Note that there may be multiple possible $x$ that Gojou could have chosen. Marin can find any possible $x$ that could have resulted in the final value of $a$ .
Marin and Gojou are playing hide-and-seek with an array.
Gojou initially performs the following steps:
- First, Gojou chooses $2$ integers $l$ and $r$ such that $l \leq r$ .
- Then, Gojou makes an array $a$ of length $r-l+1$ which is a permutation of the array $[l,l+1,\ldots,r]$ .
- Finally, Gojou chooses a secret integer $x$ and sets $a_i$ to $a_i \oplus x$ for all $i$ (where $\oplus$ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)).
Marin is then given the values of $l,r$ and the final array $a$ . She needs to find the secret integer $x$ to win. Can you help her?
Note that there may be multiple possible $x$ that Gojou could have chosen. Marin can find any possible $x$ that could have resulted in the final value of $a$ .
输入格式
The first line contains a single integer $t$ ( $1 \leq t \leq 10^5$ ) — the number of test cases.
In the first line of each test case contains two integers $l$ and $r$ ( $ \color{red}{\boldsymbol{0} \boldsymbol{=} \boldsymbol{l}} \le r < 2^{17}$ ).
The second line contains $r - l + 1$ integers of $a_1,a_2,\ldots,a_{r-l+1}$ ( $0 \le a_i < 2^{17}$ ). It is guaranteed that $a$ can be generated using the steps performed by Gojou.
It is guaranteed that the sum of $r - l + 1$ over all test cases does not exceed $2^{17}$ .
In the first line of each test case contains two integers $l$ and $r$ ( $ \color{red}{\boldsymbol{0} \boldsymbol{=} \boldsymbol{l}} \le r < 2^{17}$ ).
The second line contains $r - l + 1$ integers of $a_1,a_2,\ldots,a_{r-l+1}$ ( $0 \le a_i < 2^{17}$ ). It is guaranteed that $a$ can be generated using the steps performed by Gojou.
It is guaranteed that the sum of $r - l + 1$ over all test cases does not exceed $2^{17}$ .
输出格式
For each test case print an integer $x$ . If there are multiple answers, print any.
输入输出样例
输入 #1
3 0 3 3 2 1 0 0 3 4 7 6 5 0 2 1 2 3
输出 #1
0 4 3
In the first test case, the original array is $[3, 2, 1, 0]$ .
In the second test case, the original array is $[0, 3, 2, 1]$ .
In the third test case, the original array is $[2, 1, 0]$ .
In the second test case, the original array is $[0, 3, 2, 1]$ .
In the third test case, the original array is $[2, 1, 0]$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted