# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951108 | koukirocks | Colors (BOI20_colors) | C++17 | 1 ms | 600 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>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=2e5+10,P=998244353;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
int n;
int main() {
speed;
cin>>n;
int cnt=0;
if (n<=64) {
int now=1;
int x;
cnt++;
cout<<"? 1\n"<<flush;
cin>>x;
for (int i=1;i<n;i++) {
now+=(i&1?1:-1)*(n-i);
cnt++;
cout<<"? "<<now<<"\n"<<flush;
cin>>x;
if (x==0) {
cout<<"= "<<(n-i+1)<<"\n"<<flush;
return 0;
}
}
cout<<"= 1\n"<<flush;
} else if (n<=125) {
int now=n+1>>1;
int sml;
cout<<"? "<<now<<"\n"<<flush;
cin>>sml;
cout<<"? 1\n"<<flush;
cin>>sml;
if (sml) {
n=(n+1>>1)-1;
now=1;
for (int i=1;i<n;i++) {
now+=(i&1?1:-1)*(n-i);
int x;
cout<<"? "<<now<<"\n"<<flush;
cin>>x;
if (x==0) {
cout<<"= "<<(n-i+1)<<"\n"<<flush;
return 0;
}
}
cout<<"= 1\n"<<flush;
} else {
n=(n+1>>1)-1;
now=1;
for (int i=1;i<n;i++) {
now+=(i&1?1:-1)*(2*n-i+1);
int x;
cout<<"? "<<now<<"\n"<<flush;
cin>>x;
if (x==0) {
cout<<"= "<<(2*n-i+2)<<"\n"<<flush;
return 0;
}
}
cout<<"= "<<n+1<<"\n"<<flush;
}
}
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... |