CF1365G.Secure Password
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is an interactive problem.
Ayush devised yet another scheme to set the password of his lock. The lock has n slots where each slot can hold any non-negative integer. The password P is a sequence of n integers, i-th element of which goes into the i-th slot of the lock.
To set the password, Ayush comes up with an array A of n integers each in the range [0,263−1]. He then sets the i-th element of P as the bitwise OR of all integers in the array except Ai.
You need to guess the password. To make a query, you can choose a non-empty subset of indices of the array and ask the bitwise OR all elements of the array with index in this subset. You can ask no more than 13 queries.
这是一个交互式问题。
Ayush 又设计了一种为其锁设置密码的方案。该锁有 n 个槽位,每个槽位可存储任意非负整数。密码 P 是一个长度为 n 的整数序列,其中第 i 个元素存入锁的第 i 个槽位。
为设置密码,Ayush 构造了一个长度为 n 的数组 A,其中每个元素均在区间 [0,263−1] 内。然后他将 P 的第 i 个元素设为数组 A 中除 Ai 外所有元素的按位或结果。
你需要猜出密码 P。每次查询时,你可以选择数组下标的任意一个非空子集,并询问该子集中所有下标对应数组元素的按位或值。你最多可进行 13 次查询。
输入格式
The first line of input contains one integer n (2≤n≤1000) — the number of slots in the lock.
输入的第一行包含一个整数 n(2≤n≤1000)—— 表示锁中槽位的数量。
输入输出样例
输入#1
3 1 2 4
输出#1
? 1 1 ? 1 2 ? 1 3 ! 6 5 3
说明/提示
The array A in the example is 1,2,4. The first element of the password is bitwise OR of A2 and A3, the second element is bitwise OR of A1 and A3 and the third element is bitwise OR of A1 and A2. Hence the password sequence is 6,5,3.
示例中的数组 A 为 1,2,4。密码的第一位元素是 A2 与 A3 的按位或(bitwise OR),第二位元素是 A1 与 A3 的按位或,第三位元素是 A1 与 A2 的按位或。因此,密码序列为 6,5,3。
输入解题思路,AI测评打分。不知道怎么写?