# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776322 | 2023-07-07T16:22:56 Z | GusterGoose27 | Rarest Insects (IOI22_insects) | C++17 | 58 ms | 336 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; int min_cardinality(int n) { vector<int> perm(n); iota(perm.begin(), perm.end(), 0); mt19937 gen(chrono::steady_clock::now().time_since_epoch().count()); for (int i = 1; i < n; i++) swap(perm[i], perm[gen()%(i+1)]); vector<int> reps; vector<int> extra; move_inside(perm[0]); int num_inside = 1; for (int i = 1; i < n; i++) { move_inside(perm[i]); if (press_button() > 1) { move_outside(perm[i]); extra.push_back(perm[i]); } else { num_inside++; } } int k = num_inside; if (k == 1) return n; while (extra.size() >= k) { int s = (extra.size()/2+k-1)/k; int base = num_inside/k; vector<int> l, r; for (int i = 0; i < s; i++) { move_inside(extra[i]); l.push_back(extra[i]); } for (int i = s; i < extra.size(); i++) { move_inside(extra[i]); if (press_button() > s+base) { move_outside(extra[i]); r.push_back(extra[i]); } else { l.push_back(extra[i]); } } if (l.size() == s*k) { extra = r; num_inside += l.size(); } else { extra = l; for (int v: l) move_outside(v); } } return num_inside/k; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 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 | 2 ms | 208 KB | Output is correct |
7 | Correct | 2 ms | 208 KB | Output is correct |
8 | Correct | 4 ms | 208 KB | Output is correct |
9 | Correct | 4 ms | 208 KB | Output is correct |
10 | Correct | 3 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 4 ms | 304 KB | Output is correct |
13 | Correct | 5 ms | 300 KB | Output is correct |
14 | Correct | 4 ms | 208 KB | Output is correct |
15 | Correct | 4 ms | 208 KB | Output is correct |
16 | Correct | 4 ms | 208 KB | Output is correct |
17 | Correct | 5 ms | 208 KB | Output is correct |
18 | Correct | 5 ms | 208 KB | Output is correct |
19 | Correct | 5 ms | 208 KB | Output is correct |
20 | Correct | 3 ms | 208 KB | Output is correct |
21 | Correct | 3 ms | 208 KB | Output is correct |
22 | Correct | 2 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 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 | 2 ms | 208 KB | Output is correct |
7 | Correct | 2 ms | 208 KB | Output is correct |
8 | Correct | 4 ms | 208 KB | Output is correct |
9 | Correct | 4 ms | 208 KB | Output is correct |
10 | Correct | 3 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 4 ms | 304 KB | Output is correct |
13 | Correct | 5 ms | 300 KB | Output is correct |
14 | Correct | 4 ms | 208 KB | Output is correct |
15 | Correct | 4 ms | 208 KB | Output is correct |
16 | Correct | 4 ms | 208 KB | Output is correct |
17 | Correct | 5 ms | 208 KB | Output is correct |
18 | Correct | 5 ms | 208 KB | Output is correct |
19 | Correct | 5 ms | 208 KB | Output is correct |
20 | Correct | 3 ms | 208 KB | Output is correct |
21 | Correct | 3 ms | 208 KB | Output is correct |
22 | Correct | 2 ms | 208 KB | Output is correct |
23 | Correct | 9 ms | 308 KB | Output is correct |
24 | Correct | 9 ms | 208 KB | Output is correct |
25 | Correct | 13 ms | 308 KB | Output is correct |
26 | Correct | 17 ms | 308 KB | Output is correct |
27 | Correct | 9 ms | 308 KB | Output is correct |
28 | Correct | 7 ms | 208 KB | Output is correct |
29 | Correct | 17 ms | 316 KB | Output is correct |
30 | Correct | 19 ms | 308 KB | Output is correct |
31 | Correct | 21 ms | 316 KB | Output is correct |
32 | Correct | 22 ms | 308 KB | Output is correct |
33 | Correct | 19 ms | 208 KB | Output is correct |
34 | Correct | 22 ms | 304 KB | Output is correct |
35 | Correct | 24 ms | 312 KB | Output is correct |
36 | Correct | 24 ms | 208 KB | Output is correct |
37 | Correct | 23 ms | 208 KB | Output is correct |
38 | Correct | 15 ms | 208 KB | Output is correct |
39 | Correct | 23 ms | 308 KB | Output is correct |
40 | Correct | 11 ms | 308 KB | Output is correct |
41 | Correct | 4 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 | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 208 KB | Output is correct |
6 | Correct | 0 ms | 208 KB | Output is correct |
7 | Correct | 14 ms | 208 KB | Output is correct |
8 | Correct | 15 ms | 208 KB | Output is correct |
9 | Correct | 34 ms | 312 KB | Output is correct |
10 | Correct | 35 ms | 308 KB | Output is correct |
11 | Correct | 35 ms | 316 KB | Output is correct |
12 | Correct | 24 ms | 208 KB | Output is correct |
13 | Correct | 42 ms | 304 KB | Output is correct |
14 | Correct | 51 ms | 312 KB | Output is correct |
15 | Correct | 37 ms | 336 KB | Output is correct |
16 | Correct | 50 ms | 208 KB | Output is correct |
17 | Correct | 32 ms | 208 KB | Output is correct |
18 | Correct | 39 ms | 316 KB | Output is correct |
19 | Correct | 42 ms | 316 KB | Output is correct |
20 | Correct | 42 ms | 308 KB | Output is correct |
21 | Correct | 58 ms | 316 KB | Output is correct |
22 | Correct | 34 ms | 320 KB | Output is correct |
23 | Correct | 26 ms | 296 KB | Output is correct |
24 | Correct | 33 ms | 304 KB | Output is correct |
25 | Correct | 25 ms | 208 KB | Output is correct |
26 | Correct | 18 ms | 308 KB | Output is correct |
27 | Correct | 45 ms | 316 KB | Output is correct |
28 | Correct | 48 ms | 304 KB | Output is correct |
29 | Correct | 37 ms | 304 KB | Output is correct |
30 | Correct | 40 ms | 316 KB | Output is correct |
31 | Correct | 20 ms | 208 KB | Output is correct |
32 | Correct | 46 ms | 308 KB | Output is correct |
33 | Correct | 44 ms | 304 KB | Output is correct |
34 | Correct | 49 ms | 312 KB | Output is correct |
35 | Correct | 21 ms | 308 KB | Output is correct |
36 | Correct | 35 ms | 308 KB | Output is correct |
37 | Correct | 51 ms | 316 KB | Output is correct |
38 | Correct | 40 ms | 316 KB | Output is correct |
39 | Correct | 36 ms | 312 KB | Output is correct |
40 | Correct | 40 ms | 208 KB | Output is correct |
41 | Correct | 22 ms | 312 KB | Output is correct |
42 | Correct | 47 ms | 312 KB | Output is correct |
43 | Correct | 5 ms | 208 KB | Output is correct |
44 | Correct | 26 ms | 304 KB | Output is correct |
45 | Correct | 41 ms | 296 KB | Output is correct |
46 | Correct | 18 ms | 312 KB | Output is correct |
47 | Correct | 20 ms | 304 KB | Output is correct |
48 | Correct | 20 ms | 312 KB | Output is correct |