# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070858 | 2024-08-22T19:57:25 Z | JoenPoenMan | Rarest Insects (IOI22_insects) | C++17 | 59 ms | 688 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(int n) { int k = 0; vector<int> S; for (int i = 0; i< n; i++) { move_inside(i); if (press_button() == 2) { move_outside(i); } else S.push_back(i); } k = S.size(); int _n = n, y = 0; vector<bool> active(n, 1); while (_n >= k) { int x = (_n+2*k-1)/(2*k); for (int i : S) move_outside(i); S.clear(); for (int i = 0; i< n; i++) if (active[i]) { move_inside(i); if (press_button() == x+1) { move_outside(i); } else S.push_back(i); } if (S.size() < x*k) { active.assign(n, 0); _n = 0; for (int i : S) active[i] = 1, _n++; } else { for (int i : S) { _n -= active[i]; active[i] = 0; } y += x; } } int l = 0, h = _n; while (l < h) { int x = (l+h+1)/2; for (int i : S) move_outside(i); S.clear(); for (int i = 0; i< n; i++) if (active[i]) { move_inside(i); if (press_button() == x+1) { move_outside(i); } else S.push_back(i); } if (S.size() < x*k) { h = x-1; } else { l = x; } } return y+l; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 504 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 5 ms | 344 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |
8 | Correct | 3 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 5 ms | 344 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 2 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 3 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 344 KB | Output is correct |
20 | Correct | 4 ms | 344 KB | Output is correct |
21 | Correct | 6 ms | 600 KB | Output is correct |
22 | Correct | 3 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 504 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 5 ms | 344 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |
8 | Correct | 3 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 5 ms | 344 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 2 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 3 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 344 KB | Output is correct |
20 | Correct | 4 ms | 344 KB | Output is correct |
21 | Correct | 6 ms | 600 KB | Output is correct |
22 | Correct | 3 ms | 344 KB | Output is correct |
23 | Correct | 24 ms | 436 KB | Output is correct |
24 | Correct | 8 ms | 344 KB | Output is correct |
25 | Correct | 22 ms | 432 KB | Output is correct |
26 | Correct | 23 ms | 600 KB | Output is correct |
27 | Correct | 9 ms | 344 KB | Output is correct |
28 | Correct | 24 ms | 600 KB | Output is correct |
29 | Correct | 15 ms | 600 KB | Output is correct |
30 | Correct | 16 ms | 428 KB | Output is correct |
31 | Correct | 20 ms | 344 KB | Output is correct |
32 | Correct | 14 ms | 344 KB | Output is correct |
33 | Correct | 10 ms | 432 KB | Output is correct |
34 | Correct | 20 ms | 440 KB | Output is correct |
35 | Correct | 22 ms | 344 KB | Output is correct |
36 | Correct | 14 ms | 344 KB | Output is correct |
37 | Correct | 14 ms | 344 KB | Output is correct |
38 | Correct | 18 ms | 436 KB | Output is correct |
39 | Correct | 19 ms | 344 KB | Output is correct |
40 | Correct | 26 ms | 600 KB | Output is correct |
41 | Correct | 28 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 32 ms | 428 KB | Output is correct |
8 | Correct | 16 ms | 340 KB | Output is correct |
9 | Correct | 31 ms | 688 KB | Output is correct |
10 | Partially correct | 31 ms | 344 KB | Output is partially correct |
11 | Correct | 23 ms | 344 KB | Output is correct |
12 | Correct | 24 ms | 664 KB | Output is correct |
13 | Correct | 35 ms | 428 KB | Output is correct |
14 | Partially correct | 26 ms | 344 KB | Output is partially correct |
15 | Correct | 31 ms | 344 KB | Output is correct |
16 | Correct | 30 ms | 344 KB | Output is correct |
17 | Partially correct | 35 ms | 592 KB | Output is partially correct |
18 | Correct | 32 ms | 600 KB | Output is correct |
19 | Correct | 33 ms | 428 KB | Output is correct |
20 | Correct | 29 ms | 344 KB | Output is correct |
21 | Partially correct | 27 ms | 428 KB | Output is partially correct |
22 | Partially correct | 47 ms | 344 KB | Output is partially correct |
23 | Partially correct | 57 ms | 344 KB | Output is partially correct |
24 | Partially correct | 51 ms | 592 KB | Output is partially correct |
25 | Partially correct | 59 ms | 688 KB | Output is partially correct |
26 | Partially correct | 54 ms | 600 KB | Output is partially correct |
27 | Partially correct | 22 ms | 588 KB | Output is partially correct |
28 | Partially correct | 42 ms | 412 KB | Output is partially correct |
29 | Partially correct | 32 ms | 592 KB | Output is partially correct |
30 | Partially correct | 32 ms | 344 KB | Output is partially correct |
31 | Partially correct | 27 ms | 436 KB | Output is partially correct |
32 | Partially correct | 32 ms | 436 KB | Output is partially correct |
33 | Partially correct | 43 ms | 428 KB | Output is partially correct |
34 | Partially correct | 38 ms | 344 KB | Output is partially correct |
35 | Partially correct | 34 ms | 344 KB | Output is partially correct |
36 | Partially correct | 33 ms | 344 KB | Output is partially correct |
37 | Partially correct | 36 ms | 428 KB | Output is partially correct |
38 | Partially correct | 20 ms | 344 KB | Output is partially correct |
39 | Partially correct | 42 ms | 664 KB | Output is partially correct |
40 | Partially correct | 32 ms | 668 KB | Output is partially correct |
41 | Partially correct | 38 ms | 428 KB | Output is partially correct |
42 | Partially correct | 40 ms | 592 KB | Output is partially correct |
43 | Correct | 6 ms | 344 KB | Output is correct |
44 | Correct | 16 ms | 344 KB | Output is correct |
45 | Correct | 28 ms | 436 KB | Output is correct |
46 | Correct | 20 ms | 596 KB | Output is correct |
47 | Correct | 29 ms | 344 KB | Output is correct |
48 | Correct | 24 ms | 344 KB | Output is correct |