# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
649660 | 2022-10-11T08:02:09 Z | DJeniUp | Colors (BOI20_colors) | C++17 | 0 ms | 208 KB |
#include "bits/stdc++.h" //#pragma GCC optimize("O3") using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll>pairll; typedef long double ld; #define fr first #define sc second #define pb push_back #define INF 100000000007 #define endl '\n' #define MOD 998244353 #define A 31 #define N 500007 ll n; int main(){ cin>>n; if(n==1){ cout<<"= "<<1<<endl; cout.flush(); return 0; } ll a=1; ll b=1+n/4; ll c=b+(n+1)/2; ll d=n; ll f=0; ll f1=-1; ll l=1; ll r=n; cout<<"? "<<b<<endl; cout.flush(); ll x; cin>>x; while(l<r){ //cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl; ll m1=(l+r)/2; if(f==-1){ f=0; b=(c-m1+b)/2; cout<<"? "<<b<<endl; cout.flush(); cin>>x; if(x==0){ f1=-1; l=max(l,c-b+1); }else{ f1=-1; r=min(r,c-b); } }else{ f1=0; c=(c+b+m1)/2; cout<<"? "<<c<<endl; cout.flush(); cin>>x; if(x==0){ f=-1; l=max(l,c-b+1); }else{ f=-1; r=min(r,c-b); } } } cout<<"= "<<l<<endl; cout.flush(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | OK (3 queries) |
2 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | OK (3 queries) |
2 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | OK (3 queries) |
2 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | OK (3 queries) |
2 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | OK (3 queries) |
2 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |