#include<bits/stdc++.h>
using namespace std;
bool pors(int l,int r){
if(l>r||l<=0){
return 0;
}
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";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
111 ms |
344 KB |
Output is correct |
2 |
Correct |
105 ms |
344 KB |
Output is correct |
3 |
Correct |
132 ms |
344 KB |
Output is correct |
4 |
Correct |
126 ms |
340 KB |
Output is correct |
5 |
Correct |
114 ms |
344 KB |
Output is correct |
6 |
Correct |
129 ms |
344 KB |
Output is correct |
7 |
Correct |
65 ms |
344 KB |
Output is correct |
8 |
Correct |
124 ms |
344 KB |
Output is correct |
9 |
Correct |
136 ms |
344 KB |
Output is correct |
10 |
Correct |
119 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
111 ms |
344 KB |
Output is correct |
2 |
Correct |
105 ms |
344 KB |
Output is correct |
3 |
Correct |
132 ms |
344 KB |
Output is correct |
4 |
Correct |
126 ms |
340 KB |
Output is correct |
5 |
Correct |
114 ms |
344 KB |
Output is correct |
6 |
Correct |
129 ms |
344 KB |
Output is correct |
7 |
Correct |
65 ms |
344 KB |
Output is correct |
8 |
Correct |
124 ms |
344 KB |
Output is correct |
9 |
Correct |
136 ms |
344 KB |
Output is correct |
10 |
Correct |
119 ms |
344 KB |
Output is correct |
11 |
Correct |
1182 ms |
344 KB |
Output is correct |
12 |
Correct |
1165 ms |
344 KB |
Output is correct |
13 |
Correct |
1008 ms |
344 KB |
Output is correct |
14 |
Correct |
1168 ms |
344 KB |
Output is correct |
15 |
Correct |
1128 ms |
344 KB |
Output is correct |
16 |
Correct |
1121 ms |
344 KB |
Output is correct |
17 |
Correct |
662 ms |
344 KB |
Output is correct |
18 |
Correct |
1068 ms |
344 KB |
Output is correct |
19 |
Correct |
1079 ms |
344 KB |
Output is correct |
20 |
Correct |
1117 ms |
344 KB |
Output is correct |
21 |
Correct |
1076 ms |
344 KB |
Output is correct |
22 |
Correct |
1100 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1085 ms |
412 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
111 ms |
344 KB |
Output is correct |
2 |
Correct |
105 ms |
344 KB |
Output is correct |
3 |
Correct |
132 ms |
344 KB |
Output is correct |
4 |
Correct |
126 ms |
340 KB |
Output is correct |
5 |
Correct |
114 ms |
344 KB |
Output is correct |
6 |
Correct |
129 ms |
344 KB |
Output is correct |
7 |
Correct |
65 ms |
344 KB |
Output is correct |
8 |
Correct |
124 ms |
344 KB |
Output is correct |
9 |
Correct |
136 ms |
344 KB |
Output is correct |
10 |
Correct |
119 ms |
344 KB |
Output is correct |
11 |
Correct |
1182 ms |
344 KB |
Output is correct |
12 |
Correct |
1165 ms |
344 KB |
Output is correct |
13 |
Correct |
1008 ms |
344 KB |
Output is correct |
14 |
Correct |
1168 ms |
344 KB |
Output is correct |
15 |
Correct |
1128 ms |
344 KB |
Output is correct |
16 |
Correct |
1121 ms |
344 KB |
Output is correct |
17 |
Correct |
662 ms |
344 KB |
Output is correct |
18 |
Correct |
1068 ms |
344 KB |
Output is correct |
19 |
Correct |
1079 ms |
344 KB |
Output is correct |
20 |
Correct |
1117 ms |
344 KB |
Output is correct |
21 |
Correct |
1076 ms |
344 KB |
Output is correct |
22 |
Correct |
1100 ms |
344 KB |
Output is correct |
23 |
Runtime error |
1085 ms |
412 KB |
Execution killed with signal 13 |
24 |
Halted |
0 ms |
0 KB |
- |