# include "cup.h"
# include "bits/stdc++.h"
using namespace std;
# define ask ask_shahrasb
vector<int> find_cup() {
vector<int>ans(2);
int orig = ask(0,0);
int signx,signy;
if(ask((1 << 29),0) & (1 << 29)) signx = -1;
else signx = 1;
if(ask(0,(1 << 29)) & (1 << 29)) signy = -1;
else signy = 1;
int x = 0;
for(int i = 0;i < 29;i++)
{
if((orig ^ ask((1 << i) * -signx,0)) != (1 << i)) x += (1 << i);
}
int y = orig ^ x;
x *= signx;
y *= signy;
ans[0] = x;
ans[1] = y;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |