Submission #72563

# Submission time Handle Problem Language Result Execution time Memory
72563 2018-08-26T09:28:49 Z idan_izmirli Cup of Jamshid (IOI17_cup) C++14
100 / 100
2 ms 376 KB
#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;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct