#include <bits/stdc++.h>
using namespace std;
#define ff first;
#define ss second
#define pb push_back
//#define int long long
int k,l,r,n,ans;
bool b1;
int main(){
cin>>n;
cout<<"? "<<1<<endl;
cin>>b1;
l=2;
r=n;
k=2;
while(l<=r){
if(k%2==0){
cout<<"? "<<r<<endl;
cin>>b1;
if(b1==1){
ans=r-(l-1);
}else{
break;
}
r--;
}else{
cout<<"? "<<l<<endl;
cin>>b1;
if(b1==1){
ans=(r+1)-l;
}else{
break;
}
l++;
}
k++;
}
cout<<"= "<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Correct |
1 ms |
344 KB |
OK (26 queries) |
5 |
Correct |
0 ms |
344 KB |
OK (13 queries) |
6 |
Correct |
0 ms |
344 KB |
OK (26 queries) |
7 |
Correct |
0 ms |
344 KB |
OK (17 queries) |
8 |
Correct |
0 ms |
344 KB |
OK (7 queries) |
9 |
Correct |
0 ms |
344 KB |
OK (9 queries) |
10 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
11 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
12 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
13 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
14 |
Correct |
0 ms |
344 KB |
OK (16 queries) |
15 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
16 |
Correct |
1 ms |
344 KB |
OK (34 queries) |
17 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 35] |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Correct |
1 ms |
344 KB |
OK (26 queries) |
5 |
Correct |
0 ms |
344 KB |
OK (13 queries) |
6 |
Correct |
0 ms |
344 KB |
OK (26 queries) |
7 |
Correct |
0 ms |
344 KB |
OK (17 queries) |
8 |
Correct |
0 ms |
344 KB |
OK (7 queries) |
9 |
Correct |
0 ms |
344 KB |
OK (9 queries) |
10 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
11 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
12 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
13 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
14 |
Correct |
0 ms |
344 KB |
OK (16 queries) |
15 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
16 |
Correct |
1 ms |
344 KB |
OK (34 queries) |
17 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 35] |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Correct |
1 ms |
344 KB |
OK (26 queries) |
5 |
Correct |
0 ms |
344 KB |
OK (13 queries) |
6 |
Correct |
0 ms |
344 KB |
OK (26 queries) |
7 |
Correct |
0 ms |
344 KB |
OK (17 queries) |
8 |
Correct |
0 ms |
344 KB |
OK (7 queries) |
9 |
Correct |
0 ms |
344 KB |
OK (9 queries) |
10 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
11 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
12 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
13 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
14 |
Correct |
0 ms |
344 KB |
OK (16 queries) |
15 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
16 |
Correct |
1 ms |
344 KB |
OK (34 queries) |
17 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 35] |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Correct |
1 ms |
344 KB |
OK (26 queries) |
5 |
Correct |
0 ms |
344 KB |
OK (13 queries) |
6 |
Correct |
0 ms |
344 KB |
OK (26 queries) |
7 |
Correct |
0 ms |
344 KB |
OK (17 queries) |
8 |
Correct |
0 ms |
344 KB |
OK (7 queries) |
9 |
Correct |
0 ms |
344 KB |
OK (9 queries) |
10 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
11 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
12 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
13 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
14 |
Correct |
0 ms |
344 KB |
OK (16 queries) |
15 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
16 |
Correct |
1 ms |
344 KB |
OK (34 queries) |
17 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 35] |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (6 queries) |
3 |
Correct |
0 ms |
344 KB |
OK (10 queries) |
4 |
Correct |
1 ms |
344 KB |
OK (26 queries) |
5 |
Correct |
0 ms |
344 KB |
OK (13 queries) |
6 |
Correct |
0 ms |
344 KB |
OK (26 queries) |
7 |
Correct |
0 ms |
344 KB |
OK (17 queries) |
8 |
Correct |
0 ms |
344 KB |
OK (7 queries) |
9 |
Correct |
0 ms |
344 KB |
OK (9 queries) |
10 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
11 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
12 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
13 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
14 |
Correct |
0 ms |
344 KB |
OK (16 queries) |
15 |
Correct |
0 ms |
344 KB |
OK (11 queries) |
16 |
Correct |
1 ms |
344 KB |
OK (34 queries) |
17 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 35] |
18 |
Halted |
0 ms |
0 KB |
- |