Codeforces E. XOR Guessing

编程入门 行业动态 更新时间:2024-10-25 04:25:52

E. XOR Guessing

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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/blog/entry/45307.

The jury picked an integer xx not less than 00 and not greater than 214−1214−1. You have to guess this integer.

To do so, you may ask no more than 22 queries. Each query should consist of 100100 integer numbers a1a1, a2a2, ..., a100a100 (each integer should be not less than 00 and not greater than 214−1214−1). In response to your query, the jury will pick one integer ii (1≤i≤1001≤i≤100) and tell you the value of ai⊕xai⊕x (the bitwise XOR of aiai and xx). There is an additional constraint on the queries: all 200200 integers you use in the queries should be distinct.

It is guaranteed that the value of xx is fixed beforehand in each test, but the choice of ii in every query may depend on the integers you send.

Output

To give the answer, your program should print one line !! xx 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 22 queries. To ask a query, print one line in the following format: ?? a1a1 a2a2 ... a100a100, where every ajaj should be an integer from the range [0,214−1][0,214−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 ai⊕xai⊕x for some i∈[1,100]i∈[1,100]. No integer can be used in queries more than once.

If you submit an incorrect query (or ask more than 22 queries), the answer to it will be one integer −1−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".

Example

input

Copy

0
32

output

Copy

? 3 5 6
? 32 24 37
! 5

Note

The example of interaction is not correct — you should sumbit exactly 100100 integers in each query. Everything else is correct.

Hacks are forbidden in this problem.

这题很简单,暴力就好,贴AC代码吧

print('?', *[(i+1) << 7 for i in range(100)], '\n', '?', *[(i+1) for i in range(100)])
print("!",((int(input()) & 0x7F)|(int(input()) & 0x3F80)))

 

更多推荐

Codeforces E. XOR Guessing

本文发布于:2023-06-13 22:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413156.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Codeforces   XOR   Guessing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!