#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
376 KB |
Output is correct |