E - Bitwise Queries 传送门 题意 有一组序列,长度为 \(n(4\le n \le 2^{16})\),且 \(n\) 为 2 的整数次幂,序列中数值范围为 [0,n-1], 每次可以发起一次询问,询问分为以下几种: AND i j XOR i j OR i j 即序列中第 i 个数字和第 j 个数字的位运算结果,请你在不超过 n+1 次询问前提下求出这个序列. 此题的简单版本询问次数不超过 n+2 次. 首先要知道这几条规则: a + b = a ^ b + 2 * (a…
B. Lost Number[CF交互题 暴力] 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…
E. The penguin's game time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Pay attention: this problem is interactive. Penguin Xoriy came up with a new game recently. He has n icicles number…
D. Searching Rectangles 题目连接: http://codeforces.com/contest/714/problem/D Description Filya just learned new geometry object - rectangle. He is given a field consisting of n × n unit cells. Rows are numbered from bottom to top with integer from 1 to…
Problem K. KMC Attacks 题目连接: http://codeforces.com/gym/100714 Description Warrant VI is a remote planet located in the Koprulu Sector. Warrant VI features a strange huge field, which was discovered by the Kel-Morian Combine (KMC). The KMC is involved…
参考:https://blog.csdn.net/clover_hxy/article/details/70767653 人生第一次交互题...不是很难但是思维和传统题差别挺大的(以及并不会本地测试= =),详见参考blog和代码吧 #include"gap.h" #include<iostream> #include<cstdio> using namespace std; const long long inf=1e18; long long findGap…
记录一下第一次写交互题 题目大意:一共有1<<n个人参加一场竞标赛,需要你通过比较两人的胜场来判断谁晋级,最终获得第一名 最多1/3*2^(n+1)次询问,每次询问query(a,b),如果a胜场多返回1,如果b胜场多返回2,相同胜场返回0 找到冠军后输出"! i"(i为冠军的编号) 思路: 每次取四个人一组,因为如果这一组人进行了t轮比赛后,最终有一人胜出,那么他们的胜场将为 [ t , t , t+1 , t+2 ],而且 t 和 t 不能出现在同一组,那么他们的胜场排…
Polycarp has n coins, the value of the i-th coin is ai. It is guaranteed that all the values are integer powers of 2 (i.e. ai=2d for some non-negative integer number d). Polycarp wants to know answers on q queries. The j-th query is described as inte…