제출 #51165

#제출 시각아이디문제언어결과실행 시간메모리
51165MatheusLealVCup of Jamshid (IOI17_cup)C++17
100 / 100
3 ms248 KiB
#include "cup.h"
#include <bits/stdc++.h>
 
using namespace std;
 
vector<int> find_cup()
{
	int valmax = 500000001;
 
	int a = valmax, b = valmax;
 
	int X_xor_Y = ask_shahrasb(valmax, valmax);
 
	for(int i = 29; i >= 0; i--)
	{
		if(!(X_xor_Y & (1<<i)))
		{
			int val = ask_shahrasb(valmax -(1<<i), valmax);
  
			if( !((val ^ X_xor_Y) == (1<<i) )) a += (1<<i), b += (1<<i); 
 		}
 
		else
		{
			int val = ask_shahrasb(valmax - (1<<i), valmax);
 
			if(!((val ^ X_xor_Y) == (1<<i) )) a += (1<<i);
 
			else b += (1<<i);
		}
	}
 
	if(a > 500000001) a = a - (1<<30) + 1;
 
	if(b > 500000001) b = b - (1<<30) + 1;
  
	return {a, b};
}
#Verdict Execution timeMemoryGrader output
Fetching results...