Submission #124623

# Submission time Handle Problem Language Result Execution time Memory
124623 2019-07-03T15:20:38 Z mraron Cup of Jamshid (IOI17_cup) C++14
100 / 100
8 ms 376 KB
#include "cup.h"
#include<iostream>
using namespace std;
#define ask ask_shahrasb 

vector<int> find_cup() {
	vector<int> res(2);
	int minf=-1e9;
	int diff=ask(minf, minf);
	int bdiff=0;
	for(int i=0;i<31;++i) {
		int val=ask(minf, minf+(1<<i));
		vector<int> holkul;
		for(int j=0;j<31;++j) {
			if(((1<<j)&val)!=((1<<j)&diff)) holkul.push_back(j);
		}
		
		if(holkul.size()==1) {
			bdiff^=1<<i;
		}
	}
	
	int adiff=0;
	for(int j=0;j<31;++j) {
		if(diff&(1<<j)) {
			adiff+=(bdiff&(1<<j))^(diff&(1<<j));
		}else {
			adiff+=(bdiff&(1<<j));
		}
	}
	
	res[0]=adiff+minf;
	res[1]=bdiff+minf;
	
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 376 KB Output is correct