#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
//#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
#define y1 YONE
#define free freeee
#define lcm llcm
/*
⠄⠄⠄⠄⢠⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣯⢻⣿⣿⣿⣿⣆⠄⠄⠄
⠄⠄⣼⢀⣿⣿⣿⣿⣏⡏⠄⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢻⣿⣿⣿⣿⡆⠄⠄
⠄⠄⡟⣼⣿⣿⣿⣿⣿⠄⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⣿⣇⢻⣿⣿⣿⣿⠄⠄
⠄⢰⠃⣿⣿⠿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠙⠿⣿⣿⣿⣿⣿⠄⢿⣿⣿⣿⡄⠄
⠄⢸⢠⣿⣿⣧⡙⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠈⠛⢿⣿⣿⡇⠸⣿⡿⣸⡇⠄
⠄⠈⡆⣿⣿⣿⣿⣦⡙⠳⠄⠄⠄⠄⠄⠄⢀⣠⣤⣀⣈⠙⠃⠄⠿⢇⣿⡇⠄
⠄⠄⡇⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⣠⣶⣿⣿⣿⣿⣿⣿⣷⣆⡀⣼⣿⡇⠄
⠄⠄⢹⡘⣿⣿⣿⢿⣷⡀⠄⢀⣴⣾⣟⠉⠉⠉⠉⣽⣿⣿⣿⣿⠇⢹⣿⠃⠄
⠄⠄⠄⢷⡘⢿⣿⣎⢻⣷⠰⣿⣿⣿⣿⣦⣀⣀⣴⣿⣿⣿⠟⢫⡾⢸⡟⠄.
⠄⠄⠄⠄⠻⣦⡙⠿⣧⠙⢷⠙⠻⠿⢿⡿⠿⠿⠛⠋⠉⠄⠂⠘⠁⠞⠄⠄⠄
⠄⠄⠄⠄⠄⠈⠙⠑⣠⣤⣴⡖⠄⠿⣋⣉⣉⡁⠄⢾⣦⠄⠄⠄⠄⠄⠄⠄⠄
*/
typedef unsigned long long ull;
using namespace std;
int a[64],n,c;
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;c=n;
set<int> s;bool h;
cout<<"? 1"<<endl;cin>>h;
for (int i=2;i<=n;i++) s.ep(i);
int x=n-1,last=1;
for (int i=1;i<n;i++){
//cout<<x<<endl;
if (s.count(last+x)) cout<<"? "<<last+x<<endl,s.erase(last+x),last+=x;
else cout<<"? "<<last-x<<endl,s.erase(last-x),last-=x;
cin>>h;
if (!h) {c=x+1;break;}
else x--;
}cout<<"= "<<c<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
444 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Incorrect |
0 ms |
344 KB |
Wrong guess |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
444 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Incorrect |
0 ms |
344 KB |
Wrong guess |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
444 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Incorrect |
0 ms |
344 KB |
Wrong guess |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
444 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Incorrect |
0 ms |
344 KB |
Wrong guess |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
444 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Incorrect |
0 ms |
344 KB |
Wrong guess |
5 |
Halted |
0 ms |
0 KB |
- |