#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 n;
cin>>n;
for(int i=2;i<=n;i++){
if(pors(i-res,i)){
res++;
}else if(pors(i-res-1,i)){
res+=2;
}
}
cout<<"! "<<res<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
344 KB |
Output is correct |
2 |
Correct |
75 ms |
344 KB |
Output is correct |
3 |
Correct |
75 ms |
340 KB |
Output is correct |
4 |
Correct |
76 ms |
344 KB |
Output is correct |
5 |
Correct |
73 ms |
344 KB |
Output is correct |
6 |
Correct |
68 ms |
344 KB |
Output is correct |
7 |
Correct |
33 ms |
344 KB |
Output is correct |
8 |
Correct |
72 ms |
344 KB |
Output is correct |
9 |
Correct |
46 ms |
344 KB |
Output is correct |
10 |
Correct |
78 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
344 KB |
Output is correct |
2 |
Correct |
75 ms |
344 KB |
Output is correct |
3 |
Correct |
75 ms |
340 KB |
Output is correct |
4 |
Correct |
76 ms |
344 KB |
Output is correct |
5 |
Correct |
73 ms |
344 KB |
Output is correct |
6 |
Correct |
68 ms |
344 KB |
Output is correct |
7 |
Correct |
33 ms |
344 KB |
Output is correct |
8 |
Correct |
72 ms |
344 KB |
Output is correct |
9 |
Correct |
46 ms |
344 KB |
Output is correct |
10 |
Correct |
78 ms |
344 KB |
Output is correct |
11 |
Correct |
761 ms |
344 KB |
Output is correct |
12 |
Correct |
729 ms |
344 KB |
Output is correct |
13 |
Correct |
759 ms |
344 KB |
Output is correct |
14 |
Correct |
694 ms |
344 KB |
Output is correct |
15 |
Correct |
688 ms |
340 KB |
Output is correct |
16 |
Correct |
371 ms |
344 KB |
Output is correct |
17 |
Correct |
387 ms |
344 KB |
Output is correct |
18 |
Correct |
746 ms |
344 KB |
Output is correct |
19 |
Correct |
288 ms |
344 KB |
Output is correct |
20 |
Correct |
709 ms |
344 KB |
Output is correct |
21 |
Correct |
773 ms |
344 KB |
Output is correct |
22 |
Correct |
773 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1154 ms |
344 KB |
Output is correct |
2 |
Correct |
871 ms |
344 KB |
Output is correct |
3 |
Correct |
1002 ms |
344 KB |
Output is correct |
4 |
Correct |
655 ms |
344 KB |
Output is correct |
5 |
Correct |
545 ms |
344 KB |
Output is correct |
6 |
Correct |
1101 ms |
344 KB |
Output is correct |
7 |
Correct |
536 ms |
344 KB |
Output is correct |
8 |
Correct |
1172 ms |
344 KB |
Output is correct |
9 |
Correct |
1132 ms |
344 KB |
Output is correct |
10 |
Correct |
1186 ms |
344 KB |
Output is correct |
11 |
Correct |
575 ms |
344 KB |
Output is correct |
12 |
Correct |
586 ms |
344 KB |
Output is correct |
13 |
Correct |
1167 ms |
344 KB |
Output is correct |
14 |
Correct |
1183 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
344 KB |
Output is correct |
2 |
Correct |
75 ms |
344 KB |
Output is correct |
3 |
Correct |
75 ms |
340 KB |
Output is correct |
4 |
Correct |
76 ms |
344 KB |
Output is correct |
5 |
Correct |
73 ms |
344 KB |
Output is correct |
6 |
Correct |
68 ms |
344 KB |
Output is correct |
7 |
Correct |
33 ms |
344 KB |
Output is correct |
8 |
Correct |
72 ms |
344 KB |
Output is correct |
9 |
Correct |
46 ms |
344 KB |
Output is correct |
10 |
Correct |
78 ms |
344 KB |
Output is correct |
11 |
Correct |
761 ms |
344 KB |
Output is correct |
12 |
Correct |
729 ms |
344 KB |
Output is correct |
13 |
Correct |
759 ms |
344 KB |
Output is correct |
14 |
Correct |
694 ms |
344 KB |
Output is correct |
15 |
Correct |
688 ms |
340 KB |
Output is correct |
16 |
Correct |
371 ms |
344 KB |
Output is correct |
17 |
Correct |
387 ms |
344 KB |
Output is correct |
18 |
Correct |
746 ms |
344 KB |
Output is correct |
19 |
Correct |
288 ms |
344 KB |
Output is correct |
20 |
Correct |
709 ms |
344 KB |
Output is correct |
21 |
Correct |
773 ms |
344 KB |
Output is correct |
22 |
Correct |
773 ms |
344 KB |
Output is correct |
23 |
Correct |
1154 ms |
344 KB |
Output is correct |
24 |
Correct |
871 ms |
344 KB |
Output is correct |
25 |
Correct |
1002 ms |
344 KB |
Output is correct |
26 |
Correct |
655 ms |
344 KB |
Output is correct |
27 |
Correct |
545 ms |
344 KB |
Output is correct |
28 |
Correct |
1101 ms |
344 KB |
Output is correct |
29 |
Correct |
536 ms |
344 KB |
Output is correct |
30 |
Correct |
1172 ms |
344 KB |
Output is correct |
31 |
Correct |
1132 ms |
344 KB |
Output is correct |
32 |
Correct |
1186 ms |
344 KB |
Output is correct |
33 |
Correct |
575 ms |
344 KB |
Output is correct |
34 |
Correct |
586 ms |
344 KB |
Output is correct |
35 |
Correct |
1167 ms |
344 KB |
Output is correct |
36 |
Correct |
1183 ms |
344 KB |
Output is correct |
37 |
Correct |
1171 ms |
344 KB |
Output is correct |
38 |
Correct |
1131 ms |
344 KB |
Output is correct |
39 |
Correct |
1182 ms |
344 KB |
Output is correct |
40 |
Correct |
1148 ms |
344 KB |
Output is correct |
41 |
Correct |
1072 ms |
344 KB |
Output is correct |
42 |
Correct |
681 ms |
344 KB |
Output is correct |
43 |
Correct |
585 ms |
344 KB |
Output is correct |
44 |
Correct |
1134 ms |
344 KB |
Output is correct |
45 |
Correct |
569 ms |
344 KB |
Output is correct |
46 |
Correct |
1183 ms |
344 KB |
Output is correct |
47 |
Correct |
1085 ms |
344 KB |
Output is correct |
48 |
Correct |
1083 ms |
344 KB |
Output is correct |
49 |
Correct |
498 ms |
344 KB |
Output is correct |
50 |
Correct |
1148 ms |
344 KB |
Output is correct |
51 |
Correct |
1191 ms |
344 KB |
Output is correct |
52 |
Correct |
1113 ms |
344 KB |
Output is correct |