CF835E.The penguin's game
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Pay attention: this problem is interactive.
Penguin Xoriy came up with a new game recently. He has n icicles numbered from 1 to n. Each icicle has a temperature — an integer from 1 to 109. Exactly two of these icicles are special: their temperature is y, while a temperature of all the others is x ≠ y. You have to find those special icicles. You can choose a non-empty subset of icicles and ask the penguin what is the bitwise exclusive OR (XOR) of the temperatures of the icicles in this subset. Note that you can't ask more than 19 questions.
You are to find the special icicles.
注意:本题为交互式题目。
企鹅 Xoriy 最近发明了一个新游戏。他有 n 根冰凌,编号从 1 到 n。每根冰凌都有一个温度——一个介于 1 到 10⁹ 之间的整数。其中恰好有两根冰凌是特殊的:它们的温度均为 y,而其余所有冰凌的温度均为 x(且 x ≠ y)。你需要找出这两根特殊的冰凌。你可以选择一个非空的冰凌子集,并向企鹅询问该子集中所有冰凌温度的按位异或(XOR)值。注意:你最多只能提问 19 次。
你的任务是找出这两根特殊的冰凌。
输入格式
The first line contains three integers n, x, y (2 ≤ n ≤ 1000, 1 ≤ x, y ≤ 109, x ≠ y) — the number of icicles, the temperature of non-special icicles and the temperature of the special icicles.
第一行包含三个整数 n、x、y(2 ≤ n ≤ 1000,1 ≤ x, y ≤ 109,x = y)—— 分别表示冰棱的数量、非特殊冰棱的温度以及特殊冰棱的温度。
输出格式
To give your answer to the penguin you have to print character "!" (without quotes), then print two integers _p_1, _p_2 (_p_1 < _p_2) — the indexes of the special icicles in ascending order. Note that "!" and _p_1 should be separated by a space; the indexes should be separated by a space too. After you gave the answer your program should terminate immediately.
要向企鹅给出答案,你需要先输出字符 !(不带引号),然后输出两个整数 p1、p2(满足 p1<p2)——即两个特殊冰锥的下标(升序排列)。注意:! 与 p1 之间需用空格分隔;两个下标之间也需用空格分隔。在给出答案后,你的程序应立即终止。
输入输出样例
输入#1
4 2 1 2 1 1
输出#1
? 3 1 2 3 ? 1 1 ? 1 3 ! 1 3
说明/提示
The answer for the first question is
.
The answer for the second and the third questions is 1, therefore, special icicles are indexes 1 and 3.
You can read more about bitwise XOR operation here: https://en.wikipedia.org/wiki/Bitwise_operation#XOR.
第一个问题的答案是
。
第二个和第三个问题的答案均为 1,因此,特殊的冰柱对应索引 1 和 3。
关于按位异或(XOR)运算的更多内容,请参见:https://en.wikipedia.org/wiki/Bitwise_operation#XOR。
输入解题思路,AI测评打分。不知道怎么写?