#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define all(x) x.begin(), x.end()
//#define endl '\n'
const int N=200005;
int ask(int a,int b){
cout<<"? "<<a<<' '<<b<<endl;
int p;cin>>p;
return p;
}
int32_t main() {
LCBorz;
int n;cin>>n;
int ans=0;
for(int t:{0,1}){
int len=t;
for(int i=1;i<=n;i++){
while(i+len+1<=n&&ask(i,i+len+1)){
len+=2;
i--;
}
ans=max(ans,len);
}
}
cout<<"! "<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
452 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
452 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
604 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
452 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |