题目大意: 本题有两个隐藏起来的a b(1<=a,b<=1e30) 每次可 printf("? %d %d\n",c,d); 表示询问 a^c 与 b^d 的相对大小 最多可询问62次 然后 scanf("%d",&ans); 读入返回的答案 ans=1 说明 a^c > b^d ans=0 说明 a^c = b^d ans=-1 说明 a^c < b^d 当通过询问确定了a b就 printf("! %d %d\n&quo…
题目大意: 在一棵树中 选出k个联通块 使得 这k个联通块的点权总和 / k 最大 并且这k个联通块不相互覆盖(即一个点只能属于一个联通块) 如果有多种方案,找到k最大的那种 给定n 有n个点 给定n个点的点权(点权可能出现负数) 给定这个树的n-1条边 当将所有点分成联通块后,比较各个强联通块的点权总和,绝对存在最大值,而点权总和=最大值的也可能有多个 此时 若选择了所有点权总和等于最大值的联通块,那么 /k 之后得到的 ans=这个最大值 假设继续选择次大值,那么此时 res = (ans*…
题意:有两数a,b,每次你可以给定c,d询问a xor c和b xor d的大小关系,最多询问62次($a,b<=2^{30}$),问a和b 考虑从高位往低位做,正在做第i位,已经知道了a和b的前i-1位 这样的话,只要让a.c,b.d的前i-1位相同,就和前i-1位没关系了 考虑在第i位上abcd的情况对应的回答(后面的位数都给0),其中~表示与第i位后面的相关 那我可以分别用01 10询问两次,如果是先大后小或是先小后大,就能判断出是00或者11 但如果前后两次相同,那就有可能是01或者10…
题面 Given two integers \(n\) and \(x\), construct an array that satisfies the following conditions: ·for any element ai in the array, \(1≤ai<2^n\); ·there is no non-empty subsegment with bitwise XOR equal to \(0\) or \(x\), ·its length \(l\) should be…
D. Ehab and another another xor problem 题目链接:https://codeforces.com/contest/1088/problem/D Description: This is an interactive problem! Ehab plays a game with Laggy. Ehab has 2 hidden integers (a,b)(a,b). Laggy can ask a pair of integers (c,d)(c,d) a…
Codeforces Round #525 (Div. 2) 哎,忍不住想吐槽一下,又要准备训练,又要做些无聊的事,弄得我都想退出了. 好好的训练不好么???? 只能做出两道水题,其实C题,感觉做出来了,差几分钟,不能提交了,明天交一发试试吧. 题目一览表 来源 考察知识点 完成时间 A Ehab and another construction problem cf 签到?? 2018.12.4 B Ehab and subtraction cf 签到?? 2018.12.4 C Ehab a…
Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # include <bits/stdc++.h> int main() { int x; scanf("%d", &x); for(int i = 1; i <= x; i++) for(int j = 1; j <= x; j++) if((i % j == 0) &…
A. Ehab and another construction problem Water. #include <bits/stdc++.h> using namespace std; int x; int main() { while (scanf("%d", &x) != EOF) { , b = -; ; i <= x && a == - && b == -; ++i) { for (int j = i; j <=…
A:Ehab and another construction problem #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout); #define LL long long #define ULL unsigned LL #de…
Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题 [Problem Description] ​ 总共两次询问,每次询问给出\(100\)个不同的数,评测系统对于每次询问,随机从\(100\)个数中选择一个数\(a\),返回\(x\oplus a\).让你通过两次返回的值猜出\(x\)值是多少.要求两次询问的\(200\)个数互不相同,且题目保证\(x\)值固定不变. [Solution] ​ 题目要求所…