Submission #124330

#TimeUsernameProblemLanguageResultExecution timeMemory
124330AngusRitossaCup of Jamshid (IOI17_cup)C++14
100 / 100
3 ms376 KiB
#include "cup.h" #include <bits/stdc++.h> using namespace std; vector<int> find_cup() { vector<int> result; int fir = -536870912; int x = -536870912; int y = 536870912; int a = ask_shahrasb(x, y); for (int i = 0; i < 32; i++) { if (a & (1 << i)) { int newx = x+(1 << i); if (ask_shahrasb(newx, y) == (a^(1 << i))) fir+=1<<i; else fir-=1<<i; } } int sec = 536870911; x = 536870911; a = ask_shahrasb(x, y); for (int i = 0; i < 32; i++) { if (a & (1 << i)) { int newx = x-(1 << i); if (ask_shahrasb(newx, y) == (a^(1 << i))) sec-=1<<i; else sec+=1<<i; } } int ansx = (fir+sec)/2; int ansy = 536870912 - (sec-fir)/2; result.push_back(ansx); result.push_back(ansy); return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...