#include<bits/stdc++.h>
using namespace std;
bool pors(int l,int r){
if(l>r||l<=0){
return 0;
}
if(l==r){
return 1;
}
cout<<"? "<<l<<" "<<r<<endl;
int x;
cin>>x;
return x;
}
int main(){
int res=1;
int l=1;
int n;
cin>>n;
for(int i=2;i<=n;i++){
l--;
while(pors(l,i)==0){
l++;
}
res=max(res,i-l+1);
}
cout<<"! "<<res<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
344 KB |
Output is correct |
2 |
Correct |
60 ms |
344 KB |
Output is correct |
3 |
Correct |
79 ms |
344 KB |
Output is correct |
4 |
Correct |
132 ms |
344 KB |
Output is correct |
5 |
Correct |
111 ms |
344 KB |
Output is correct |
6 |
Correct |
112 ms |
344 KB |
Output is correct |
7 |
Correct |
77 ms |
344 KB |
Output is correct |
8 |
Correct |
122 ms |
344 KB |
Output is correct |
9 |
Correct |
114 ms |
344 KB |
Output is correct |
10 |
Correct |
69 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
344 KB |
Output is correct |
2 |
Correct |
60 ms |
344 KB |
Output is correct |
3 |
Correct |
79 ms |
344 KB |
Output is correct |
4 |
Correct |
132 ms |
344 KB |
Output is correct |
5 |
Correct |
111 ms |
344 KB |
Output is correct |
6 |
Correct |
112 ms |
344 KB |
Output is correct |
7 |
Correct |
77 ms |
344 KB |
Output is correct |
8 |
Correct |
122 ms |
344 KB |
Output is correct |
9 |
Correct |
114 ms |
344 KB |
Output is correct |
10 |
Correct |
69 ms |
344 KB |
Output is correct |
11 |
Correct |
1061 ms |
344 KB |
Output is correct |
12 |
Correct |
724 ms |
344 KB |
Output is correct |
13 |
Correct |
697 ms |
344 KB |
Output is correct |
14 |
Correct |
999 ms |
344 KB |
Output is correct |
15 |
Correct |
679 ms |
344 KB |
Output is correct |
16 |
Correct |
1060 ms |
344 KB |
Output is correct |
17 |
Correct |
782 ms |
596 KB |
Output is correct |
18 |
Correct |
982 ms |
344 KB |
Output is correct |
19 |
Correct |
1137 ms |
344 KB |
Output is correct |
20 |
Correct |
959 ms |
344 KB |
Output is correct |
21 |
Correct |
745 ms |
344 KB |
Output is correct |
22 |
Correct |
731 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1002 ms |
408 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
344 KB |
Output is correct |
2 |
Correct |
60 ms |
344 KB |
Output is correct |
3 |
Correct |
79 ms |
344 KB |
Output is correct |
4 |
Correct |
132 ms |
344 KB |
Output is correct |
5 |
Correct |
111 ms |
344 KB |
Output is correct |
6 |
Correct |
112 ms |
344 KB |
Output is correct |
7 |
Correct |
77 ms |
344 KB |
Output is correct |
8 |
Correct |
122 ms |
344 KB |
Output is correct |
9 |
Correct |
114 ms |
344 KB |
Output is correct |
10 |
Correct |
69 ms |
344 KB |
Output is correct |
11 |
Correct |
1061 ms |
344 KB |
Output is correct |
12 |
Correct |
724 ms |
344 KB |
Output is correct |
13 |
Correct |
697 ms |
344 KB |
Output is correct |
14 |
Correct |
999 ms |
344 KB |
Output is correct |
15 |
Correct |
679 ms |
344 KB |
Output is correct |
16 |
Correct |
1060 ms |
344 KB |
Output is correct |
17 |
Correct |
782 ms |
596 KB |
Output is correct |
18 |
Correct |
982 ms |
344 KB |
Output is correct |
19 |
Correct |
1137 ms |
344 KB |
Output is correct |
20 |
Correct |
959 ms |
344 KB |
Output is correct |
21 |
Correct |
745 ms |
344 KB |
Output is correct |
22 |
Correct |
731 ms |
344 KB |
Output is correct |
23 |
Runtime error |
1002 ms |
408 KB |
Execution killed with signal 13 |
24 |
Halted |
0 ms |
0 KB |
- |