#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
constexpr int N = (int)2e5 + 111;
constexpr int md = (int)2e5 + 111;
mt19937 rnd(time(nullptr));
set<int> was_asked;
int ask(int x){
assert(!was_asked.count(x));
was_asked.insert(x);
cout << "? " << x << "\n";
cout.flush();
int answer;
cin >> answer;
return answer;
}
void solve(){
int n;
cin >> n;
ask(1);
int pr = 1;
int l = 2, r = n;
for(int it = 0; l <= r; it^=1){
if(it == 0){
int check = ask(r--);
if(!check){
cout << "= " << r - l + 3 << "\n";
return;
}
} else {
int check = ask(l++);
if(!check){
cout << "= " << r - l + 3 << "\n";
return;
}
}
}
return;
}
signed main(){
ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
// init();
int tests = 1;
// cin >> tests;
for(int test = 1; test <= tests; test++){
// cerr << "test = " << test << "\n";
solve();
}
return 0;
}
/**
**/
Compilation message
Colors.cpp: In function 'void solve()':
Colors.cpp:37:9: warning: unused variable 'pr' [-Wunused-variable]
37 | int pr = 1;
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (6 queries) |
3 |
Correct |
1 ms |
300 KB |
OK (10 queries) |
4 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (6 queries) |
3 |
Correct |
1 ms |
300 KB |
OK (10 queries) |
4 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (6 queries) |
3 |
Correct |
1 ms |
300 KB |
OK (10 queries) |
4 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (6 queries) |
3 |
Correct |
1 ms |
300 KB |
OK (10 queries) |
4 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (6 queries) |
3 |
Correct |
1 ms |
300 KB |
OK (10 queries) |
4 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
5 |
Halted |
0 ms |
0 KB |
- |