# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124330 | AngusRitossa | Cup of Jamshid (IOI17_cup) | C++14 | 3 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |