# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1054634 | 2024-08-12T11:16:45 Z | shmax | Rarest Insects (IOI22_insects) | C++17 | 227 ms | 848 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; #define len(x) ((int)(x.size())) #define all(x) x.begin(), x.end() template<typename T> using vec = vector<T>; template<typename T> using graph = vec<vec<T>>; mt19937 rnd(2312); int min_cardinality(int n) { graph<int> g(n); auto connect = [&](int u, int v) { g[u].push_back(v); g[v].push_back(u); }; vec<int> ord(n); int diff = 0; vec<int> in; for (int i = 0; i < n; i++) { move_inside(i); if (press_button() > 1) { move_outside(i); } else { diff++; in.push_back(i); } } for (auto x: in) { move_outside(x); } int tcnt = n; int tl = 1; int tr = tcnt; iota(all(ord), 0); auto check = [&](int x) { int cnt = 0; vec<int> ins; for (int i: ord) { move_inside(i); if (press_button() > x) { move_outside(i); } else { cnt++; ins.push_back(i); } if (cnt == x * diff) break; } for (auto y: ins) { move_outside(y); } tcnt = cnt; return cnt == x * diff; }; while (tr > 2) { int tm = tr / diff; if (check(tm)) { return tm; } else { tr = tcnt; } } if (check(2)) { return 2; } return 1; }
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 | 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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 344 KB | Output is correct |
9 | Correct | 7 ms | 344 KB | Output is correct |
10 | Correct | 4 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 9 ms | 344 KB | Output is correct |
13 | Correct | 9 ms | 344 KB | Output is correct |
14 | Correct | 6 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 344 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 7 ms | 344 KB | Output is correct |
18 | Correct | 11 ms | 344 KB | Output is correct |
19 | Correct | 6 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 436 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 2 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 | 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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 344 KB | Output is correct |
9 | Correct | 7 ms | 344 KB | Output is correct |
10 | Correct | 4 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 9 ms | 344 KB | Output is correct |
13 | Correct | 9 ms | 344 KB | Output is correct |
14 | Correct | 6 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 344 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 7 ms | 344 KB | Output is correct |
18 | Correct | 11 ms | 344 KB | Output is correct |
19 | Correct | 6 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 436 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 2 ms | 344 KB | Output is correct |
23 | Correct | 11 ms | 344 KB | Output is correct |
24 | Correct | 9 ms | 344 KB | Output is correct |
25 | Correct | 8 ms | 340 KB | Output is correct |
26 | Correct | 68 ms | 468 KB | Output is correct |
27 | Correct | 54 ms | 464 KB | Output is correct |
28 | Correct | 12 ms | 460 KB | Output is correct |
29 | Correct | 130 ms | 344 KB | Output is correct |
30 | Correct | 174 ms | 468 KB | Output is correct |
31 | Correct | 31 ms | 344 KB | Output is correct |
32 | Correct | 46 ms | 468 KB | Output is correct |
33 | Correct | 79 ms | 600 KB | Output is correct |
34 | Correct | 73 ms | 448 KB | Output is correct |
35 | Correct | 31 ms | 344 KB | Output is correct |
36 | Correct | 45 ms | 344 KB | Output is correct |
37 | Correct | 28 ms | 344 KB | Output is correct |
38 | Correct | 33 ms | 452 KB | Output is correct |
39 | Correct | 14 ms | 344 KB | Output is correct |
40 | Correct | 15 ms | 344 KB | Output is correct |
41 | Correct | 9 ms | 720 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 | Partially correct | 0 ms | 344 KB | Output is partially correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 14 ms | 496 KB | Output is correct |
8 | Correct | 20 ms | 848 KB | Output is correct |
9 | Correct | 16 ms | 484 KB | Output is correct |
10 | Partially correct | 176 ms | 728 KB | Output is partially correct |
11 | Partially correct | 116 ms | 344 KB | Output is partially correct |
12 | Correct | 31 ms | 600 KB | Output is correct |
13 | Incorrect | 227 ms | 736 KB | Too many queries. |
14 | Halted | 0 ms | 0 KB | - |