CF1364E.X-OR
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is an interactive problem!
Ehab has a hidden permutation p of length n consisting of the elements from 0 to n−1. You, for some reason, want to figure out the permutation. To do that, you can give Ehab 2 different indices i and j, and he'll reply with (pi∣pj) where ∣ is the bitwise-or operation.
Ehab has just enough free time to answer 4269 questions, and while he's OK with answering that many questions, he's too lazy to play your silly games, so he'll fix the permutation beforehand and will not change it depending on your queries. Can you guess the permutation?
这是一个交互式问题!
Ehab 有一个长度为 n 的隐藏排列 p,其中包含从 0 到 n−1 的所有整数。出于某种原因,你希望还原出这个排列。为此,你可以向 Ehab 提供两个不同的下标 i 和 j,他将返回 (pi∣pj),其中 ∣ 表示按位或运算。
Ehab 只有足够的时间回答 4269 个问题;虽然他愿意回答这么多问题,但他懒得陪你玩这种无聊的游戏,因此他会预先固定好这个排列,并且在你提问的过程中不会根据你的查询动态更改该排列。你能否猜出这个排列?
输入格式
The only line contains the integer n (3≤n≤2048) — the length of the permutation.
唯一的一行包含一个整数 n(3≤n≤2048)——排列的长度。
输入输出样例
输入#1
3 1 3 2
输出#1
? 1 2 ? 1 3 ? 2 3 ! 1 0 2
说明/提示
In the first sample, the permutation is [1,0,2]. You start by asking about p1∣p2 and Ehab replies with 1. You then ask about p1∣p3 and Ehab replies with 3. Finally, you ask about p2∣p3 and Ehab replies with 2. You then guess the permutation.
在第一个样例中,排列为 [1,0,2]。你首先询问 p1∣p2,Ehab 回答 1;接着你询问 p1∣p3,Ehab 回答 3;最后你询问 p2∣p3,Ehab 回答 2。随后你猜出了该排列。
输入解题思路,AI测评打分。不知道怎么写?