A14518 | XOR Guessing
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: <https://codeforces.com/blog/entry/45307>.
The jury picked an integer $x$ not less than $0$ and not greater than $2^{14} - 1$ . You have to guess this integer.
To do so, you may ask no more than $2$ queries. Each query should consist of $100$ integer numbers $a_1$ , $a_2$ , ..., $a_{100}$ (each integer should be not less than $0$ and not greater than $2^{14} - 1$ ). In response to your query, the jury will pick one integer $i$ ( $1 \le i \le 100$ ) and tell you the value of $a_i \oplus x$ (the bitwise XOR of $a_i$ and $x$ ). There is an additional constraint on the queries: all $200$ integers you use in the queries should be distinct.
It is guaranteed that the value of $x$ is fixed beforehand in each test, but the choice of $i$ in every query may depend on the integers you send.
Output
To give the answer, your program should print one line $!$ $x$ with a line break in the end. After that, it should flush the output and terminate gracefully.
The jury picked an integer $x$ not less than $0$ and not greater than $2^{14} - 1$ . You have to guess this integer.
To do so, you may ask no more than $2$ queries. Each query should consist of $100$ integer numbers $a_1$ , $a_2$ , ..., $a_{100}$ (each integer should be not less than $0$ and not greater than $2^{14} - 1$ ). In response to your query, the jury will pick one integer $i$ ( $1 \le i \le 100$ ) and tell you the value of $a_i \oplus x$ (the bitwise XOR of $a_i$ and $x$ ). There is an additional constraint on the queries: all $200$ integers you use in the queries should be distinct.
It is guaranteed that the value of $x$ is fixed beforehand in each test, but the choice of $i$ in every query may depend on the integers you send.
Output
To give the answer, your program should print one line $!$ $x$ with a line break in the end. After that, it should flush the output and terminate gracefully.
输入格式
无
输出格式
To give the answer, your program should print one line $!$ $x$ with a line break in the end. After that, it should flush the output and terminate gracefully.
Interaction
Before giving the answer, you may submit no more than $2$ queries. To ask a query, print one line in the following format: $?$ $a_1$ $a_2$ ... $a_{100}$ , where every $a_j$ should be an integer from the range $[0, 2^{14} - 1]$ . The line should be ended with a line break character. After submitting a query, flush the output and read the answer to your query — the value of $a_i \oplus x$ for some $i \in [1, 100]$ . No integer can be used in queries more than once.
If you submit an incorrect query (or ask more than $2$ queries), the answer to it will be one integer $-1$ . After receiving such an answer, your program should terminate immediately — otherwise you may receive verdict "Runtime error", "Time limit exceeded" or some other verdict instead of "Wrong answer".
Interaction
Before giving the answer, you may submit no more than $2$ queries. To ask a query, print one line in the following format: $?$ $a_1$ $a_2$ ... $a_{100}$ , where every $a_j$ should be an integer from the range $[0, 2^{14} - 1]$ . The line should be ended with a line break character. After submitting a query, flush the output and read the answer to your query — the value of $a_i \oplus x$ for some $i \in [1, 100]$ . No integer can be used in queries more than once.
If you submit an incorrect query (or ask more than $2$ queries), the answer to it will be one integer $-1$ . After receiving such an answer, your program should terminate immediately — otherwise you may receive verdict "Runtime error", "Time limit exceeded" or some other verdict instead of "Wrong answer".
输入输出样例
输入 #1
0 32
输出 #1
? 3 5 6 ? 32 24 37 ! 5
The example of interaction is not correct — you should sumbit exactly $100$ integers in each query. Everything else is correct.
Hacks are forbidden in this problem.
Hacks are forbidden in this problem.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted