Submission #837978

# Submission time Handle Problem Language Result Execution time Memory
837978 2023-08-26T01:46:51 Z 1075508020060209tc Colors (BOI20_colors) C++14
0 / 100
1 ms 208 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")

#include <bits/stdc++.h>
using namespace std;
int n;
int ask(int v){
cout<<"? "<<v<<endl;
int ret;
cin>>ret;
return ret;
}
void solve64(){
ask(1);
int lst=1;
int lit=2;int rit=n;
for(int i=1;i<=64;i++){
    if(i%2==1){
        int v=rit;
        int vl=ask(rit--);
        if(vl==0){
            cout<<"= "<<abs(v-lst)+1<<endl;exit(0);
        }
        lst=v;
    }else{
        int v=lit;
        int vl=ask(lit++);
        if(vl==0){
            cout<<"= "<<abs(v-lst)+1<<endl;exit(0);
        }
        lst=v;
    }
}


}


signed main(){
cin>>n;
if(n<=64){
    solve64();
}




}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB OK (5 queries)
2 Correct 0 ms 208 KB OK (6 queries)
3 Correct 1 ms 208 KB OK (10 queries)
4 Incorrect 0 ms 208 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB OK (5 queries)
2 Correct 0 ms 208 KB OK (6 queries)
3 Correct 1 ms 208 KB OK (10 queries)
4 Incorrect 0 ms 208 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB OK (5 queries)
2 Correct 0 ms 208 KB OK (6 queries)
3 Correct 1 ms 208 KB OK (10 queries)
4 Incorrect 0 ms 208 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB OK (5 queries)
2 Correct 0 ms 208 KB OK (6 queries)
3 Correct 1 ms 208 KB OK (10 queries)
4 Incorrect 0 ms 208 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB OK (5 queries)
2 Correct 0 ms 208 KB OK (6 queries)
3 Correct 1 ms 208 KB OK (10 queries)
4 Incorrect 0 ms 208 KB Hair color 14 was used multiple times
5 Halted 0 ms 0 KB -