# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
837151 | 2023-08-25T03:18:41 Z | biank | Rarest Insects (IOI22_insects) | C++17 | 165 ms | 596 KB |
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define DBGY(x) cerr << #x << ": " << x << ", "; #define DBG(x) cerr << #x << ": " << x << endl; void move_inside(int i); void move_outside(int i); int press_button(); stack <int> in; set <int> s; int T; bool check(int m, int &K) { int old_k = K; for (int i:s) { move_inside(i); if (press_button() <= m) { in.push(i); if (++K == m*T) { while (!in.empty()) { s.erase(in.top()); in.pop(); } return true; } } else { move_outside(i); } } s.clear(); while (!in.empty()) { s.insert(in.top()); move_outside(in.top()); in.pop(); } K = old_k; return false; } int min_cardinality(int N) { move_inside(0); in.push(0); s.insert(0); T = 1; for (int i=1; i<N; i++) { s.insert(i); move_inside(i); if (press_button() == 1) { in.push(i); T++; } else { move_outside(i); } } while (!in.empty()) { move_outside(in.top()); in.pop(); } int K = 0, l = 0, r = N+1; while (l+1 < r) { assert(in.empty()); int m = (l+r)/2; if (check(m, K)) { l = m; } else { r = m; } } return l; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 208 KB | Output is correct |
7 | Correct | 10 ms | 304 KB | Output is correct |
8 | Correct | 7 ms | 208 KB | Output is correct |
9 | Correct | 5 ms | 300 KB | Output is correct |
10 | Correct | 3 ms | 208 KB | Output is correct |
11 | Correct | 11 ms | 308 KB | Output is correct |
12 | Correct | 7 ms | 300 KB | Output is correct |
13 | Correct | 10 ms | 312 KB | Output is correct |
14 | Correct | 8 ms | 300 KB | Output is correct |
15 | Correct | 9 ms | 308 KB | Output is correct |
16 | Correct | 12 ms | 208 KB | Output is correct |
17 | Correct | 5 ms | 208 KB | Output is correct |
18 | Correct | 12 ms | 300 KB | Output is correct |
19 | Correct | 13 ms | 304 KB | Output is correct |
20 | Correct | 14 ms | 300 KB | Output is correct |
21 | Correct | 14 ms | 304 KB | Output is correct |
22 | Correct | 15 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 1 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 208 KB | Output is correct |
7 | Correct | 10 ms | 304 KB | Output is correct |
8 | Correct | 7 ms | 208 KB | Output is correct |
9 | Correct | 5 ms | 300 KB | Output is correct |
10 | Correct | 3 ms | 208 KB | Output is correct |
11 | Correct | 11 ms | 308 KB | Output is correct |
12 | Correct | 7 ms | 300 KB | Output is correct |
13 | Correct | 10 ms | 312 KB | Output is correct |
14 | Correct | 8 ms | 300 KB | Output is correct |
15 | Correct | 9 ms | 308 KB | Output is correct |
16 | Correct | 12 ms | 208 KB | Output is correct |
17 | Correct | 5 ms | 208 KB | Output is correct |
18 | Correct | 12 ms | 300 KB | Output is correct |
19 | Correct | 13 ms | 304 KB | Output is correct |
20 | Correct | 14 ms | 300 KB | Output is correct |
21 | Correct | 14 ms | 304 KB | Output is correct |
22 | Correct | 15 ms | 304 KB | Output is correct |
23 | Correct | 16 ms | 336 KB | Output is correct |
24 | Correct | 45 ms | 456 KB | Output is correct |
25 | Correct | 35 ms | 348 KB | Output is correct |
26 | Correct | 65 ms | 312 KB | Output is correct |
27 | Correct | 12 ms | 328 KB | Output is correct |
28 | Correct | 61 ms | 324 KB | Output is correct |
29 | Correct | 29 ms | 336 KB | Output is correct |
30 | Correct | 58 ms | 320 KB | Output is correct |
31 | Correct | 32 ms | 324 KB | Output is correct |
32 | Correct | 36 ms | 328 KB | Output is correct |
33 | Correct | 33 ms | 344 KB | Output is correct |
34 | Correct | 48 ms | 336 KB | Output is correct |
35 | Correct | 41 ms | 316 KB | Output is correct |
36 | Correct | 52 ms | 316 KB | Output is correct |
37 | Correct | 30 ms | 348 KB | Output is correct |
38 | Correct | 77 ms | 324 KB | Output is correct |
39 | Correct | 57 ms | 328 KB | Output is correct |
40 | Correct | 68 ms | 336 KB | Output is correct |
41 | Correct | 79 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
6 | Correct | 1 ms | 208 KB | Output is correct |
7 | Correct | 34 ms | 328 KB | Output is correct |
8 | Partially correct | 159 ms | 512 KB | Output is partially correct |
9 | Partially correct | 129 ms | 448 KB | Output is partially correct |
10 | Partially correct | 63 ms | 384 KB | Output is partially correct |
11 | Partially correct | 38 ms | 452 KB | Output is partially correct |
12 | Partially correct | 130 ms | 364 KB | Output is partially correct |
13 | Partially correct | 91 ms | 384 KB | Output is partially correct |
14 | Partially correct | 101 ms | 596 KB | Output is partially correct |
15 | Partially correct | 31 ms | 388 KB | Output is partially correct |
16 | Partially correct | 89 ms | 388 KB | Output is partially correct |
17 | Partially correct | 70 ms | 496 KB | Output is partially correct |
18 | Partially correct | 67 ms | 336 KB | Output is partially correct |
19 | Partially correct | 108 ms | 380 KB | Output is partially correct |
20 | Partially correct | 87 ms | 488 KB | Output is partially correct |
21 | Partially correct | 69 ms | 380 KB | Output is partially correct |
22 | Partially correct | 70 ms | 388 KB | Output is partially correct |
23 | Partially correct | 107 ms | 380 KB | Output is partially correct |
24 | Partially correct | 115 ms | 484 KB | Output is partially correct |
25 | Partially correct | 165 ms | 388 KB | Output is partially correct |
26 | Partially correct | 141 ms | 384 KB | Output is partially correct |
27 | Partially correct | 110 ms | 484 KB | Output is partially correct |
28 | Partially correct | 90 ms | 380 KB | Output is partially correct |
29 | Partially correct | 93 ms | 376 KB | Output is partially correct |
30 | Partially correct | 93 ms | 392 KB | Output is partially correct |
31 | Partially correct | 110 ms | 444 KB | Output is partially correct |
32 | Partially correct | 103 ms | 380 KB | Output is partially correct |
33 | Partially correct | 90 ms | 592 KB | Output is partially correct |
34 | Partially correct | 140 ms | 472 KB | Output is partially correct |
35 | Partially correct | 110 ms | 432 KB | Output is partially correct |
36 | Partially correct | 91 ms | 372 KB | Output is partially correct |
37 | Partially correct | 141 ms | 380 KB | Output is partially correct |
38 | Partially correct | 111 ms | 384 KB | Output is partially correct |
39 | Partially correct | 78 ms | 400 KB | Output is partially correct |
40 | Partially correct | 133 ms | 384 KB | Output is partially correct |
41 | Partially correct | 107 ms | 380 KB | Output is partially correct |
42 | Partially correct | 112 ms | 492 KB | Output is partially correct |
43 | Partially correct | 17 ms | 320 KB | Output is partially correct |
44 | Partially correct | 48 ms | 372 KB | Output is partially correct |
45 | Correct | 25 ms | 380 KB | Output is correct |
46 | Partially correct | 119 ms | 456 KB | Output is partially correct |
47 | Partially correct | 86 ms | 376 KB | Output is partially correct |
48 | Partially correct | 110 ms | 384 KB | Output is partially correct |