#include "cup.h"
using namespace std;
std::vector<int> find_cup() {
std::vector<int> result(2);
long long power=1;
long long x_dist=0;
int corner=500000000;
int base=ask_shahrasb(corner,corner);
int current;
while(power<corner)
{
current=ask_shahrasb(corner+power, corner);
while((current&power)!=(base&power))
{
x_dist+=power;
power*=2;
}
x_dist-=power/2;
}
result[0]=corner-x_dist;
if((power<2*corner)&&(result[0]-power>=-corner))
{
current=ask_shahrasb(result[0]-power/2, corner);
result[0]=corner-((base)^((current)^(power/2)));
}
result[1]=corner-((base)^(corner-result[0]));
return result;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |