# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810321 | 2023-08-06T08:26:54 Z | ymm | Colors (BOI20_colors) | C++17 | 300 ms | 256 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; set<ll> S; bool query(ll x) { assert(!S.count(x)); S.insert(x); int d; printf("? %lld\n", x+1); fflush(stdout); scanf("%d", &d); return d; } int main() { ll n; scanf("%lld", &n); //ll pos = __lg(n-1)+1; //query(pos); //ll l = 1, r = n; //while (l < r) { // ll m0 = (l+r)/2; // ll m; // for (ll i = 0;; ++i) { // ll dard = i%2? i/2+1: -i/2; // ll pos2 = pos + m0 + dard; // if (pos2 < 0 || n <= pos2 || S.count(pos2)) // continue; // m = m0+dard; // break; // } // if (query(pos + m)) { // r = m; // pos = pos + m; // } else { // l = m+1; // while (S.count(pos)) // --pos; // query(pos); // } //} ll pos = n/3; query(pos); ll l = 1, r = n; int lst = 0; while (l < r) { ll m0 = (l+r)/2; ll x = lst%2? -1: 1; //cerr << l << ' ' << r << ' ' << pos+1 << ' ' << m0 << '\n'; ll m; for (ll i = 0;; ++i) { ll dard = i%2? i/2+1: -i/2; //ll dard = i%2? -i/2+1: i/2; ll pos2 = pos + x*(m0+dard); if (pos2 < 0 || n <= pos2 || S.count(pos2)) continue; m = m0+dard; break; } if (query(pos = pos + x*m)) r = m; else l = m+1; ++lst; } printf("= %lld\n", l); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (7 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 1 ms | 208 KB | OK (5 queries) |
4 | Correct | 0 ms | 208 KB | OK (6 queries) |
5 | Correct | 0 ms | 208 KB | OK (5 queries) |
6 | Correct | 1 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 0 ms | 208 KB | OK (6 queries) |
10 | Correct | 0 ms | 208 KB | OK (5 queries) |
11 | Correct | 0 ms | 208 KB | OK (5 queries) |
12 | Correct | 1 ms | 208 KB | OK (6 queries) |
13 | Correct | 1 ms | 208 KB | OK (7 queries) |
14 | Correct | 0 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Correct | 1 ms | 208 KB | OK (6 queries) |
18 | Correct | 0 ms | 208 KB | OK (6 queries) |
19 | Correct | 0 ms | 208 KB | OK (6 queries) |
20 | Correct | 0 ms | 208 KB | OK (7 queries) |
21 | Correct | 0 ms | 208 KB | OK (7 queries) |
22 | Correct | 0 ms | 208 KB | OK (2 queries) |
23 | Correct | 0 ms | 208 KB | OK (2 queries) |
24 | Correct | 0 ms | 208 KB | OK (3 queries) |
25 | Correct | 0 ms | 208 KB | OK (3 queries) |
26 | Correct | 0 ms | 208 KB | OK (2 queries) |
27 | Correct | 0 ms | 208 KB | OK (3 queries) |
28 | Correct | 0 ms | 208 KB | OK (3 queries) |
29 | Correct | 0 ms | 208 KB | OK (3 queries) |
30 | Correct | 0 ms | 208 KB | OK (3 queries) |
31 | Correct | 0 ms | 208 KB | OK (3 queries) |
32 | Correct | 0 ms | 208 KB | OK (3 queries) |
33 | Correct | 0 ms | 208 KB | OK (3 queries) |
34 | Correct | 0 ms | 208 KB | OK (4 queries) |
35 | Correct | 0 ms | 208 KB | OK (4 queries) |
36 | Correct | 1 ms | 208 KB | OK (3 queries) |
37 | Correct | 0 ms | 208 KB | OK (4 queries) |
38 | Correct | 0 ms | 208 KB | OK (4 queries) |
39 | Correct | 0 ms | 208 KB | OK (3 queries) |
40 | Correct | 0 ms | 208 KB | OK (4 queries) |
41 | Correct | 0 ms | 208 KB | OK (4 queries) |
42 | Correct | 0 ms | 256 KB | OK (3 queries) |
43 | Correct | 0 ms | 208 KB | OK (4 queries) |
44 | Correct | 0 ms | 208 KB | OK (4 queries) |
45 | Correct | 0 ms | 208 KB | OK (7 queries) |
46 | Correct | 1 ms | 208 KB | OK (7 queries) |
47 | Correct | 0 ms | 208 KB | OK (4 queries) |
48 | Correct | 1 ms | 208 KB | OK (4 queries) |
49 | Correct | 0 ms | 208 KB | OK (4 queries) |
50 | Correct | 0 ms | 208 KB | OK (4 queries) |
51 | Correct | 0 ms | 208 KB | OK (4 queries) |
52 | Correct | 0 ms | 208 KB | OK (4 queries) |
53 | Correct | 0 ms | 208 KB | OK (4 queries) |
54 | Correct | 0 ms | 208 KB | OK (4 queries) |
55 | Correct | 0 ms | 208 KB | OK (4 queries) |
56 | Correct | 0 ms | 208 KB | OK (4 queries) |
57 | Correct | 0 ms | 208 KB | OK (5 queries) |
58 | Correct | 0 ms | 208 KB | OK (5 queries) |
59 | Execution timed out | 3057 ms | 208 KB | Time limit exceeded |
60 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (7 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 1 ms | 208 KB | OK (5 queries) |
4 | Correct | 0 ms | 208 KB | OK (6 queries) |
5 | Correct | 0 ms | 208 KB | OK (5 queries) |
6 | Correct | 1 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 0 ms | 208 KB | OK (6 queries) |
10 | Correct | 0 ms | 208 KB | OK (5 queries) |
11 | Correct | 0 ms | 208 KB | OK (5 queries) |
12 | Correct | 1 ms | 208 KB | OK (6 queries) |
13 | Correct | 1 ms | 208 KB | OK (7 queries) |
14 | Correct | 0 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Correct | 1 ms | 208 KB | OK (6 queries) |
18 | Correct | 0 ms | 208 KB | OK (6 queries) |
19 | Correct | 0 ms | 208 KB | OK (6 queries) |
20 | Correct | 0 ms | 208 KB | OK (7 queries) |
21 | Correct | 0 ms | 208 KB | OK (7 queries) |
22 | Correct | 0 ms | 208 KB | OK (2 queries) |
23 | Correct | 0 ms | 208 KB | OK (2 queries) |
24 | Correct | 0 ms | 208 KB | OK (3 queries) |
25 | Correct | 0 ms | 208 KB | OK (3 queries) |
26 | Correct | 0 ms | 208 KB | OK (2 queries) |
27 | Correct | 0 ms | 208 KB | OK (3 queries) |
28 | Correct | 0 ms | 208 KB | OK (3 queries) |
29 | Correct | 0 ms | 208 KB | OK (3 queries) |
30 | Correct | 0 ms | 208 KB | OK (3 queries) |
31 | Correct | 0 ms | 208 KB | OK (3 queries) |
32 | Correct | 0 ms | 208 KB | OK (3 queries) |
33 | Correct | 0 ms | 208 KB | OK (3 queries) |
34 | Correct | 0 ms | 208 KB | OK (4 queries) |
35 | Correct | 0 ms | 208 KB | OK (4 queries) |
36 | Correct | 1 ms | 208 KB | OK (3 queries) |
37 | Correct | 0 ms | 208 KB | OK (4 queries) |
38 | Correct | 0 ms | 208 KB | OK (4 queries) |
39 | Correct | 0 ms | 208 KB | OK (3 queries) |
40 | Correct | 0 ms | 208 KB | OK (4 queries) |
41 | Correct | 0 ms | 208 KB | OK (4 queries) |
42 | Correct | 0 ms | 256 KB | OK (3 queries) |
43 | Correct | 0 ms | 208 KB | OK (4 queries) |
44 | Correct | 0 ms | 208 KB | OK (4 queries) |
45 | Correct | 0 ms | 208 KB | OK (7 queries) |
46 | Correct | 1 ms | 208 KB | OK (7 queries) |
47 | Correct | 0 ms | 208 KB | OK (4 queries) |
48 | Correct | 1 ms | 208 KB | OK (4 queries) |
49 | Correct | 0 ms | 208 KB | OK (4 queries) |
50 | Correct | 0 ms | 208 KB | OK (4 queries) |
51 | Correct | 0 ms | 208 KB | OK (4 queries) |
52 | Correct | 0 ms | 208 KB | OK (4 queries) |
53 | Correct | 0 ms | 208 KB | OK (4 queries) |
54 | Correct | 0 ms | 208 KB | OK (4 queries) |
55 | Correct | 0 ms | 208 KB | OK (4 queries) |
56 | Correct | 0 ms | 208 KB | OK (4 queries) |
57 | Correct | 0 ms | 208 KB | OK (5 queries) |
58 | Correct | 0 ms | 208 KB | OK (5 queries) |
59 | Execution timed out | 3057 ms | 208 KB | Time limit exceeded |
60 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (7 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 1 ms | 208 KB | OK (5 queries) |
4 | Correct | 0 ms | 208 KB | OK (6 queries) |
5 | Correct | 0 ms | 208 KB | OK (5 queries) |
6 | Correct | 1 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 0 ms | 208 KB | OK (6 queries) |
10 | Correct | 0 ms | 208 KB | OK (5 queries) |
11 | Correct | 0 ms | 208 KB | OK (5 queries) |
12 | Correct | 1 ms | 208 KB | OK (6 queries) |
13 | Correct | 1 ms | 208 KB | OK (7 queries) |
14 | Correct | 0 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Correct | 1 ms | 208 KB | OK (6 queries) |
18 | Correct | 0 ms | 208 KB | OK (6 queries) |
19 | Correct | 0 ms | 208 KB | OK (6 queries) |
20 | Correct | 0 ms | 208 KB | OK (7 queries) |
21 | Correct | 0 ms | 208 KB | OK (7 queries) |
22 | Correct | 0 ms | 208 KB | OK (2 queries) |
23 | Correct | 0 ms | 208 KB | OK (2 queries) |
24 | Correct | 0 ms | 208 KB | OK (3 queries) |
25 | Correct | 0 ms | 208 KB | OK (3 queries) |
26 | Correct | 0 ms | 208 KB | OK (2 queries) |
27 | Correct | 0 ms | 208 KB | OK (3 queries) |
28 | Correct | 0 ms | 208 KB | OK (3 queries) |
29 | Correct | 0 ms | 208 KB | OK (3 queries) |
30 | Correct | 0 ms | 208 KB | OK (3 queries) |
31 | Correct | 0 ms | 208 KB | OK (3 queries) |
32 | Correct | 0 ms | 208 KB | OK (3 queries) |
33 | Correct | 0 ms | 208 KB | OK (3 queries) |
34 | Correct | 0 ms | 208 KB | OK (4 queries) |
35 | Correct | 0 ms | 208 KB | OK (4 queries) |
36 | Correct | 1 ms | 208 KB | OK (3 queries) |
37 | Correct | 0 ms | 208 KB | OK (4 queries) |
38 | Correct | 0 ms | 208 KB | OK (4 queries) |
39 | Correct | 0 ms | 208 KB | OK (3 queries) |
40 | Correct | 0 ms | 208 KB | OK (4 queries) |
41 | Correct | 0 ms | 208 KB | OK (4 queries) |
42 | Correct | 0 ms | 256 KB | OK (3 queries) |
43 | Correct | 0 ms | 208 KB | OK (4 queries) |
44 | Correct | 0 ms | 208 KB | OK (4 queries) |
45 | Correct | 0 ms | 208 KB | OK (7 queries) |
46 | Correct | 1 ms | 208 KB | OK (7 queries) |
47 | Correct | 0 ms | 208 KB | OK (4 queries) |
48 | Correct | 1 ms | 208 KB | OK (4 queries) |
49 | Correct | 0 ms | 208 KB | OK (4 queries) |
50 | Correct | 0 ms | 208 KB | OK (4 queries) |
51 | Correct | 0 ms | 208 KB | OK (4 queries) |
52 | Correct | 0 ms | 208 KB | OK (4 queries) |
53 | Correct | 0 ms | 208 KB | OK (4 queries) |
54 | Correct | 0 ms | 208 KB | OK (4 queries) |
55 | Correct | 0 ms | 208 KB | OK (4 queries) |
56 | Correct | 0 ms | 208 KB | OK (4 queries) |
57 | Correct | 0 ms | 208 KB | OK (5 queries) |
58 | Correct | 0 ms | 208 KB | OK (5 queries) |
59 | Execution timed out | 3057 ms | 208 KB | Time limit exceeded |
60 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (7 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 1 ms | 208 KB | OK (5 queries) |
4 | Correct | 0 ms | 208 KB | OK (6 queries) |
5 | Correct | 0 ms | 208 KB | OK (5 queries) |
6 | Correct | 1 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 0 ms | 208 KB | OK (6 queries) |
10 | Correct | 0 ms | 208 KB | OK (5 queries) |
11 | Correct | 0 ms | 208 KB | OK (5 queries) |
12 | Correct | 1 ms | 208 KB | OK (6 queries) |
13 | Correct | 1 ms | 208 KB | OK (7 queries) |
14 | Correct | 0 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Correct | 1 ms | 208 KB | OK (6 queries) |
18 | Correct | 0 ms | 208 KB | OK (6 queries) |
19 | Correct | 0 ms | 208 KB | OK (6 queries) |
20 | Correct | 0 ms | 208 KB | OK (7 queries) |
21 | Correct | 0 ms | 208 KB | OK (7 queries) |
22 | Correct | 0 ms | 208 KB | OK (2 queries) |
23 | Correct | 0 ms | 208 KB | OK (2 queries) |
24 | Correct | 0 ms | 208 KB | OK (3 queries) |
25 | Correct | 0 ms | 208 KB | OK (3 queries) |
26 | Correct | 0 ms | 208 KB | OK (2 queries) |
27 | Correct | 0 ms | 208 KB | OK (3 queries) |
28 | Correct | 0 ms | 208 KB | OK (3 queries) |
29 | Correct | 0 ms | 208 KB | OK (3 queries) |
30 | Correct | 0 ms | 208 KB | OK (3 queries) |
31 | Correct | 0 ms | 208 KB | OK (3 queries) |
32 | Correct | 0 ms | 208 KB | OK (3 queries) |
33 | Correct | 0 ms | 208 KB | OK (3 queries) |
34 | Correct | 0 ms | 208 KB | OK (4 queries) |
35 | Correct | 0 ms | 208 KB | OK (4 queries) |
36 | Correct | 1 ms | 208 KB | OK (3 queries) |
37 | Correct | 0 ms | 208 KB | OK (4 queries) |
38 | Correct | 0 ms | 208 KB | OK (4 queries) |
39 | Correct | 0 ms | 208 KB | OK (3 queries) |
40 | Correct | 0 ms | 208 KB | OK (4 queries) |
41 | Correct | 0 ms | 208 KB | OK (4 queries) |
42 | Correct | 0 ms | 256 KB | OK (3 queries) |
43 | Correct | 0 ms | 208 KB | OK (4 queries) |
44 | Correct | 0 ms | 208 KB | OK (4 queries) |
45 | Correct | 0 ms | 208 KB | OK (7 queries) |
46 | Correct | 1 ms | 208 KB | OK (7 queries) |
47 | Correct | 0 ms | 208 KB | OK (4 queries) |
48 | Correct | 1 ms | 208 KB | OK (4 queries) |
49 | Correct | 0 ms | 208 KB | OK (4 queries) |
50 | Correct | 0 ms | 208 KB | OK (4 queries) |
51 | Correct | 0 ms | 208 KB | OK (4 queries) |
52 | Correct | 0 ms | 208 KB | OK (4 queries) |
53 | Correct | 0 ms | 208 KB | OK (4 queries) |
54 | Correct | 0 ms | 208 KB | OK (4 queries) |
55 | Correct | 0 ms | 208 KB | OK (4 queries) |
56 | Correct | 0 ms | 208 KB | OK (4 queries) |
57 | Correct | 0 ms | 208 KB | OK (5 queries) |
58 | Correct | 0 ms | 208 KB | OK (5 queries) |
59 | Execution timed out | 3057 ms | 208 KB | Time limit exceeded |
60 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (7 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 1 ms | 208 KB | OK (5 queries) |
4 | Correct | 0 ms | 208 KB | OK (6 queries) |
5 | Correct | 0 ms | 208 KB | OK (5 queries) |
6 | Correct | 1 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 0 ms | 208 KB | OK (6 queries) |
10 | Correct | 0 ms | 208 KB | OK (5 queries) |
11 | Correct | 0 ms | 208 KB | OK (5 queries) |
12 | Correct | 1 ms | 208 KB | OK (6 queries) |
13 | Correct | 1 ms | 208 KB | OK (7 queries) |
14 | Correct | 0 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Correct | 1 ms | 208 KB | OK (6 queries) |
18 | Correct | 0 ms | 208 KB | OK (6 queries) |
19 | Correct | 0 ms | 208 KB | OK (6 queries) |
20 | Correct | 0 ms | 208 KB | OK (7 queries) |
21 | Correct | 0 ms | 208 KB | OK (7 queries) |
22 | Correct | 0 ms | 208 KB | OK (2 queries) |
23 | Correct | 0 ms | 208 KB | OK (2 queries) |
24 | Correct | 0 ms | 208 KB | OK (3 queries) |
25 | Correct | 0 ms | 208 KB | OK (3 queries) |
26 | Correct | 0 ms | 208 KB | OK (2 queries) |
27 | Correct | 0 ms | 208 KB | OK (3 queries) |
28 | Correct | 0 ms | 208 KB | OK (3 queries) |
29 | Correct | 0 ms | 208 KB | OK (3 queries) |
30 | Correct | 0 ms | 208 KB | OK (3 queries) |
31 | Correct | 0 ms | 208 KB | OK (3 queries) |
32 | Correct | 0 ms | 208 KB | OK (3 queries) |
33 | Correct | 0 ms | 208 KB | OK (3 queries) |
34 | Correct | 0 ms | 208 KB | OK (4 queries) |
35 | Correct | 0 ms | 208 KB | OK (4 queries) |
36 | Correct | 1 ms | 208 KB | OK (3 queries) |
37 | Correct | 0 ms | 208 KB | OK (4 queries) |
38 | Correct | 0 ms | 208 KB | OK (4 queries) |
39 | Correct | 0 ms | 208 KB | OK (3 queries) |
40 | Correct | 0 ms | 208 KB | OK (4 queries) |
41 | Correct | 0 ms | 208 KB | OK (4 queries) |
42 | Correct | 0 ms | 256 KB | OK (3 queries) |
43 | Correct | 0 ms | 208 KB | OK (4 queries) |
44 | Correct | 0 ms | 208 KB | OK (4 queries) |
45 | Correct | 0 ms | 208 KB | OK (7 queries) |
46 | Correct | 1 ms | 208 KB | OK (7 queries) |
47 | Correct | 0 ms | 208 KB | OK (4 queries) |
48 | Correct | 1 ms | 208 KB | OK (4 queries) |
49 | Correct | 0 ms | 208 KB | OK (4 queries) |
50 | Correct | 0 ms | 208 KB | OK (4 queries) |
51 | Correct | 0 ms | 208 KB | OK (4 queries) |
52 | Correct | 0 ms | 208 KB | OK (4 queries) |
53 | Correct | 0 ms | 208 KB | OK (4 queries) |
54 | Correct | 0 ms | 208 KB | OK (4 queries) |
55 | Correct | 0 ms | 208 KB | OK (4 queries) |
56 | Correct | 0 ms | 208 KB | OK (4 queries) |
57 | Correct | 0 ms | 208 KB | OK (5 queries) |
58 | Correct | 0 ms | 208 KB | OK (5 queries) |
59 | Execution timed out | 3057 ms | 208 KB | Time limit exceeded |
60 | Halted | 0 ms | 0 KB | - |