#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;
#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
int n, o, e;
bool que(int l, int r) {
bool foo = (114514 & 0);
cout << "? " << l << ' ' << r << endl;
cin >> foo;
return foo;
}
void solve() {
cin >> n;
FOR (i, 1, n) {
while (i - o - 1 >= 1 && i + o + 1 <= n && que(i - o - 1, i + o + 1)) o++;
while (i - e >= 1 && i + e + 1 <= n && que(i - e, i + e + 1)) e++;
}
cout << "! " << max(2 * o + 1, 2 * e) << endl;
}
int main() {
Waimai;
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
344 KB |
Output is correct |
2 |
Correct |
64 ms |
344 KB |
Output is correct |
3 |
Correct |
63 ms |
344 KB |
Output is correct |
4 |
Correct |
66 ms |
344 KB |
Output is correct |
5 |
Correct |
68 ms |
344 KB |
Output is correct |
6 |
Correct |
66 ms |
344 KB |
Output is correct |
7 |
Correct |
64 ms |
344 KB |
Output is correct |
8 |
Correct |
76 ms |
344 KB |
Output is correct |
9 |
Correct |
70 ms |
344 KB |
Output is correct |
10 |
Correct |
65 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
344 KB |
Output is correct |
2 |
Correct |
64 ms |
344 KB |
Output is correct |
3 |
Correct |
63 ms |
344 KB |
Output is correct |
4 |
Correct |
66 ms |
344 KB |
Output is correct |
5 |
Correct |
68 ms |
344 KB |
Output is correct |
6 |
Correct |
66 ms |
344 KB |
Output is correct |
7 |
Correct |
64 ms |
344 KB |
Output is correct |
8 |
Correct |
76 ms |
344 KB |
Output is correct |
9 |
Correct |
70 ms |
344 KB |
Output is correct |
10 |
Correct |
65 ms |
344 KB |
Output is correct |
11 |
Correct |
635 ms |
344 KB |
Output is correct |
12 |
Correct |
676 ms |
344 KB |
Output is correct |
13 |
Correct |
666 ms |
344 KB |
Output is correct |
14 |
Correct |
634 ms |
344 KB |
Output is correct |
15 |
Correct |
658 ms |
344 KB |
Output is correct |
16 |
Correct |
633 ms |
500 KB |
Output is correct |
17 |
Correct |
646 ms |
344 KB |
Output is correct |
18 |
Correct |
675 ms |
344 KB |
Output is correct |
19 |
Correct |
677 ms |
344 KB |
Output is correct |
20 |
Correct |
674 ms |
344 KB |
Output is correct |
21 |
Correct |
634 ms |
344 KB |
Output is correct |
22 |
Correct |
646 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
991 ms |
344 KB |
Output is correct |
2 |
Correct |
749 ms |
344 KB |
Output is correct |
3 |
Correct |
990 ms |
344 KB |
Output is correct |
4 |
Correct |
963 ms |
344 KB |
Output is correct |
5 |
Correct |
967 ms |
344 KB |
Output is correct |
6 |
Correct |
952 ms |
344 KB |
Output is correct |
7 |
Correct |
987 ms |
344 KB |
Output is correct |
8 |
Correct |
967 ms |
344 KB |
Output is correct |
9 |
Correct |
991 ms |
344 KB |
Output is correct |
10 |
Correct |
1004 ms |
344 KB |
Output is correct |
11 |
Correct |
949 ms |
344 KB |
Output is correct |
12 |
Correct |
974 ms |
344 KB |
Output is correct |
13 |
Correct |
1004 ms |
344 KB |
Output is correct |
14 |
Correct |
1016 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
344 KB |
Output is correct |
2 |
Correct |
64 ms |
344 KB |
Output is correct |
3 |
Correct |
63 ms |
344 KB |
Output is correct |
4 |
Correct |
66 ms |
344 KB |
Output is correct |
5 |
Correct |
68 ms |
344 KB |
Output is correct |
6 |
Correct |
66 ms |
344 KB |
Output is correct |
7 |
Correct |
64 ms |
344 KB |
Output is correct |
8 |
Correct |
76 ms |
344 KB |
Output is correct |
9 |
Correct |
70 ms |
344 KB |
Output is correct |
10 |
Correct |
65 ms |
344 KB |
Output is correct |
11 |
Correct |
635 ms |
344 KB |
Output is correct |
12 |
Correct |
676 ms |
344 KB |
Output is correct |
13 |
Correct |
666 ms |
344 KB |
Output is correct |
14 |
Correct |
634 ms |
344 KB |
Output is correct |
15 |
Correct |
658 ms |
344 KB |
Output is correct |
16 |
Correct |
633 ms |
500 KB |
Output is correct |
17 |
Correct |
646 ms |
344 KB |
Output is correct |
18 |
Correct |
675 ms |
344 KB |
Output is correct |
19 |
Correct |
677 ms |
344 KB |
Output is correct |
20 |
Correct |
674 ms |
344 KB |
Output is correct |
21 |
Correct |
634 ms |
344 KB |
Output is correct |
22 |
Correct |
646 ms |
344 KB |
Output is correct |
23 |
Correct |
991 ms |
344 KB |
Output is correct |
24 |
Correct |
749 ms |
344 KB |
Output is correct |
25 |
Correct |
990 ms |
344 KB |
Output is correct |
26 |
Correct |
963 ms |
344 KB |
Output is correct |
27 |
Correct |
967 ms |
344 KB |
Output is correct |
28 |
Correct |
952 ms |
344 KB |
Output is correct |
29 |
Correct |
987 ms |
344 KB |
Output is correct |
30 |
Correct |
967 ms |
344 KB |
Output is correct |
31 |
Correct |
991 ms |
344 KB |
Output is correct |
32 |
Correct |
1004 ms |
344 KB |
Output is correct |
33 |
Correct |
949 ms |
344 KB |
Output is correct |
34 |
Correct |
974 ms |
344 KB |
Output is correct |
35 |
Correct |
1004 ms |
344 KB |
Output is correct |
36 |
Correct |
1016 ms |
344 KB |
Output is correct |
37 |
Correct |
1004 ms |
340 KB |
Output is correct |
38 |
Correct |
944 ms |
344 KB |
Output is correct |
39 |
Correct |
973 ms |
344 KB |
Output is correct |
40 |
Correct |
947 ms |
500 KB |
Output is correct |
41 |
Correct |
1046 ms |
344 KB |
Output is correct |
42 |
Correct |
967 ms |
344 KB |
Output is correct |
43 |
Correct |
949 ms |
344 KB |
Output is correct |
44 |
Correct |
989 ms |
344 KB |
Output is correct |
45 |
Correct |
947 ms |
344 KB |
Output is correct |
46 |
Correct |
1006 ms |
344 KB |
Output is correct |
47 |
Correct |
993 ms |
344 KB |
Output is correct |
48 |
Correct |
998 ms |
344 KB |
Output is correct |
49 |
Correct |
992 ms |
344 KB |
Output is correct |
50 |
Correct |
1006 ms |
344 KB |
Output is correct |
51 |
Correct |
969 ms |
344 KB |
Output is correct |
52 |
Correct |
1008 ms |
344 KB |
Output is correct |