#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=1;
for(int t:{0,1}){
int len=t;
for(int i=1;i<=n;i++){
while(i>0&&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 |
Correct |
57 ms |
344 KB |
Output is correct |
2 |
Correct |
66 ms |
344 KB |
Output is correct |
3 |
Correct |
70 ms |
344 KB |
Output is correct |
4 |
Correct |
77 ms |
344 KB |
Output is correct |
5 |
Correct |
61 ms |
344 KB |
Output is correct |
6 |
Correct |
82 ms |
344 KB |
Output is correct |
7 |
Correct |
67 ms |
344 KB |
Output is correct |
8 |
Correct |
62 ms |
344 KB |
Output is correct |
9 |
Correct |
65 ms |
344 KB |
Output is correct |
10 |
Correct |
74 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
344 KB |
Output is correct |
2 |
Correct |
66 ms |
344 KB |
Output is correct |
3 |
Correct |
70 ms |
344 KB |
Output is correct |
4 |
Correct |
77 ms |
344 KB |
Output is correct |
5 |
Correct |
61 ms |
344 KB |
Output is correct |
6 |
Correct |
82 ms |
344 KB |
Output is correct |
7 |
Correct |
67 ms |
344 KB |
Output is correct |
8 |
Correct |
62 ms |
344 KB |
Output is correct |
9 |
Correct |
65 ms |
344 KB |
Output is correct |
10 |
Correct |
74 ms |
344 KB |
Output is correct |
11 |
Correct |
697 ms |
344 KB |
Output is correct |
12 |
Correct |
725 ms |
344 KB |
Output is correct |
13 |
Correct |
689 ms |
344 KB |
Output is correct |
14 |
Correct |
713 ms |
344 KB |
Output is correct |
15 |
Correct |
746 ms |
344 KB |
Output is correct |
16 |
Correct |
671 ms |
344 KB |
Output is correct |
17 |
Correct |
747 ms |
344 KB |
Output is correct |
18 |
Correct |
758 ms |
344 KB |
Output is correct |
19 |
Correct |
810 ms |
344 KB |
Output is correct |
20 |
Correct |
801 ms |
344 KB |
Output is correct |
21 |
Correct |
746 ms |
344 KB |
Output is correct |
22 |
Correct |
719 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1108 ms |
344 KB |
Output is correct |
2 |
Correct |
801 ms |
344 KB |
Output is correct |
3 |
Correct |
1120 ms |
344 KB |
Output is correct |
4 |
Correct |
1094 ms |
344 KB |
Output is correct |
5 |
Correct |
1054 ms |
344 KB |
Output is correct |
6 |
Correct |
1026 ms |
344 KB |
Output is correct |
7 |
Correct |
978 ms |
344 KB |
Output is correct |
8 |
Correct |
1097 ms |
344 KB |
Output is correct |
9 |
Correct |
1032 ms |
344 KB |
Output is correct |
10 |
Correct |
1079 ms |
344 KB |
Output is correct |
11 |
Correct |
1075 ms |
344 KB |
Output is correct |
12 |
Correct |
1079 ms |
344 KB |
Output is correct |
13 |
Correct |
1107 ms |
540 KB |
Output is correct |
14 |
Correct |
992 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
344 KB |
Output is correct |
2 |
Correct |
66 ms |
344 KB |
Output is correct |
3 |
Correct |
70 ms |
344 KB |
Output is correct |
4 |
Correct |
77 ms |
344 KB |
Output is correct |
5 |
Correct |
61 ms |
344 KB |
Output is correct |
6 |
Correct |
82 ms |
344 KB |
Output is correct |
7 |
Correct |
67 ms |
344 KB |
Output is correct |
8 |
Correct |
62 ms |
344 KB |
Output is correct |
9 |
Correct |
65 ms |
344 KB |
Output is correct |
10 |
Correct |
74 ms |
344 KB |
Output is correct |
11 |
Correct |
697 ms |
344 KB |
Output is correct |
12 |
Correct |
725 ms |
344 KB |
Output is correct |
13 |
Correct |
689 ms |
344 KB |
Output is correct |
14 |
Correct |
713 ms |
344 KB |
Output is correct |
15 |
Correct |
746 ms |
344 KB |
Output is correct |
16 |
Correct |
671 ms |
344 KB |
Output is correct |
17 |
Correct |
747 ms |
344 KB |
Output is correct |
18 |
Correct |
758 ms |
344 KB |
Output is correct |
19 |
Correct |
810 ms |
344 KB |
Output is correct |
20 |
Correct |
801 ms |
344 KB |
Output is correct |
21 |
Correct |
746 ms |
344 KB |
Output is correct |
22 |
Correct |
719 ms |
344 KB |
Output is correct |
23 |
Correct |
1108 ms |
344 KB |
Output is correct |
24 |
Correct |
801 ms |
344 KB |
Output is correct |
25 |
Correct |
1120 ms |
344 KB |
Output is correct |
26 |
Correct |
1094 ms |
344 KB |
Output is correct |
27 |
Correct |
1054 ms |
344 KB |
Output is correct |
28 |
Correct |
1026 ms |
344 KB |
Output is correct |
29 |
Correct |
978 ms |
344 KB |
Output is correct |
30 |
Correct |
1097 ms |
344 KB |
Output is correct |
31 |
Correct |
1032 ms |
344 KB |
Output is correct |
32 |
Correct |
1079 ms |
344 KB |
Output is correct |
33 |
Correct |
1075 ms |
344 KB |
Output is correct |
34 |
Correct |
1079 ms |
344 KB |
Output is correct |
35 |
Correct |
1107 ms |
540 KB |
Output is correct |
36 |
Correct |
992 ms |
344 KB |
Output is correct |
37 |
Correct |
1227 ms |
344 KB |
Output is correct |
38 |
Correct |
1067 ms |
344 KB |
Output is correct |
39 |
Correct |
1083 ms |
344 KB |
Output is correct |
40 |
Correct |
1014 ms |
344 KB |
Output is correct |
41 |
Correct |
1159 ms |
344 KB |
Output is correct |
42 |
Correct |
1024 ms |
344 KB |
Output is correct |
43 |
Correct |
1004 ms |
344 KB |
Output is correct |
44 |
Correct |
1124 ms |
344 KB |
Output is correct |
45 |
Correct |
1097 ms |
344 KB |
Output is correct |
46 |
Correct |
1108 ms |
344 KB |
Output is correct |
47 |
Correct |
1124 ms |
344 KB |
Output is correct |
48 |
Correct |
1080 ms |
344 KB |
Output is correct |
49 |
Correct |
1097 ms |
344 KB |
Output is correct |
50 |
Correct |
1057 ms |
344 KB |
Output is correct |
51 |
Correct |
1188 ms |
344 KB |
Output is correct |
52 |
Correct |
1124 ms |
344 KB |
Output is correct |