# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
922012 | owoovo | Colors (BOI20_colors) | C++14 | 0 ms | 436 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma GCC opimize("unroll-loops,O3")
#pragma GCC target("avx2")
#define int long long
#define F first
#define S second
using namespace std;
vector<int> use;
int query(int pos){
cout<<"? "<<pos<<endl;
int a;
cin>>a;
return a;
}
signed main(){
int l=1,r;
cin>>r;
while(l!=r){
int m=(l+r)/2;
use.push_back(m);
l=m+1;
}
int b=1,mn=0,npos=0;
for(auto x:use){
npos+=x*(2*b-1);
cout<<npos<<"\n";
mn=min(mn,npos);
b^=1;
}
mn=abs(mn)+1;
query(mn);
b=1;
l=1;
npos=mn;
while(l!=r){
int m=(l+r-1)/2;
npos+=m*(2*b-1);
b^=1;
if(query(npos)){
r=m;
}else{
l=m+1;
}
}
cout<<"= "<<l<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |