Submission #51078

# Submission time Handle Problem Language Result Execution time Memory
51078 2018-06-16T03:01:40 Z MatheusLealV Cup of Jamshid (IOI17_cup) C++17
0 / 100
3 ms 248 KB
#include "cup.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> find_cup()
{
	int a = 0, b = 0;

	int X_xor_Y = ask_shahrasb(0, 0);

	for(int i = 29; i >= 0; i--)
	{
		if( (X_xor_Y & (1<<i)) )
		{
			int val = ask_shahrasb( -(1<<i), 0);

			if( !((val ^ X_xor_Y) == (1<<i) )) a += (1<<i); 

			else b += (1<<i);			
		}
		else
		{
			int val = ask_shahrasb( -(1<<i), 0);

			int val2 = ask_shahrasb(0, -(1<<i));

			if( !((val ^ X_xor_Y) == (1<<i) )) a += (1<<i); 

			if( !((val2 ^ X_xor_Y) == (1<<i)) ) b += (1<<i);
		}
	}

	if(a > 500000000) a = a - (1<<30) + 1;

	if(b > 500000000) b = b - (1<<30) + 1;

	int v = ask_shahrasb(a, b);

	if(!v) return {a, b};

	if(a < 0) b = X_xor_Y ^ (-a);

	else a = X_xor_Y ^ (-b);


	if(a > 500000000) a = a - (1<<30) + 1;

	if(b > 500000000) b = b - (1<<30) + 1;

	//cout<<a<<" "<<b<<" "<<ask_shahrasb(a, b)<<"\n";

	return {a, b};
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB wrong cup location