# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
830500 | 2023-08-19T07:22:48 Z | tolbi | Rarest Insects (IOI22_insects) | C++17 | 247 ms | 304 KB |
#include <bits/stdc++.h> using namespace std; #include "insects.h" int min_cardinality(int n) { vector<int> par(n); function<int(int)> find = [&](int node)->int{ if (par[node]==node) return node; return par[node]=find(par[node]); }; vector<int> sz(n,1); iota(par.begin(), par.end(), 0); vector<int> crr; function<int()> findx; findx = [&]()->int{ for (int i = 0; i < crr.size(); i++){ move_outside(crr[i]); if (press_button()==1){ for (int j=0;j<=i;j++){ move_inside(crr[j]); } return i; } } return 23; }; for (int i = 0; i < n; i++){ move_inside(i); if (press_button()>1){ int pos = crr[findx()]; par[i]=find(pos); sz[find(pos)]++; sz[i]=0; move_outside(i); } else crr.push_back(i); } int ans = n; for (int i = 0; i < n; i++){ if (par[i]!=i) continue; ans=min(ans,sz[i]); } return ans; }
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 | 1 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 208 KB | Output is correct |
7 | Correct | 1 ms | 300 KB | Output is correct |
8 | Correct | 9 ms | 208 KB | Output is correct |
9 | Correct | 14 ms | 208 KB | Output is correct |
10 | Correct | 3 ms | 208 KB | Output is correct |
11 | Correct | 4 ms | 208 KB | Output is correct |
12 | Correct | 6 ms | 208 KB | Output is correct |
13 | Correct | 9 ms | 208 KB | Output is correct |
14 | Correct | 7 ms | 208 KB | Output is correct |
15 | Correct | 12 ms | 208 KB | Output is correct |
16 | Correct | 7 ms | 208 KB | Output is correct |
17 | Correct | 6 ms | 208 KB | Output is correct |
18 | Correct | 10 ms | 208 KB | Output is correct |
19 | Correct | 17 ms | 208 KB | Output is correct |
20 | Correct | 25 ms | 300 KB | Output is correct |
21 | Correct | 30 ms | 208 KB | Output is correct |
22 | Correct | 28 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 | 1 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 208 KB | Output is correct |
7 | Correct | 1 ms | 300 KB | Output is correct |
8 | Correct | 9 ms | 208 KB | Output is correct |
9 | Correct | 14 ms | 208 KB | Output is correct |
10 | Correct | 3 ms | 208 KB | Output is correct |
11 | Correct | 4 ms | 208 KB | Output is correct |
12 | Correct | 6 ms | 208 KB | Output is correct |
13 | Correct | 9 ms | 208 KB | Output is correct |
14 | Correct | 7 ms | 208 KB | Output is correct |
15 | Correct | 12 ms | 208 KB | Output is correct |
16 | Correct | 7 ms | 208 KB | Output is correct |
17 | Correct | 6 ms | 208 KB | Output is correct |
18 | Correct | 10 ms | 208 KB | Output is correct |
19 | Correct | 17 ms | 208 KB | Output is correct |
20 | Correct | 25 ms | 300 KB | Output is correct |
21 | Correct | 30 ms | 208 KB | Output is correct |
22 | Correct | 28 ms | 208 KB | Output is correct |
23 | Correct | 13 ms | 208 KB | Output is correct |
24 | Correct | 9 ms | 304 KB | Output is correct |
25 | Correct | 150 ms | 208 KB | Output is correct |
26 | Correct | 66 ms | 208 KB | Output is correct |
27 | Correct | 14 ms | 208 KB | Output is correct |
28 | Correct | 10 ms | 304 KB | Output is correct |
29 | Correct | 22 ms | 208 KB | Output is correct |
30 | Correct | 107 ms | 252 KB | Output is correct |
31 | Correct | 34 ms | 208 KB | Output is correct |
32 | Correct | 43 ms | 208 KB | Output is correct |
33 | Correct | 49 ms | 208 KB | Output is correct |
34 | Correct | 63 ms | 208 KB | Output is correct |
35 | Correct | 37 ms | 208 KB | Output is correct |
36 | Correct | 85 ms | 208 KB | Output is correct |
37 | Correct | 187 ms | 208 KB | Output is correct |
38 | Incorrect | 141 ms | 208 KB | Too many queries. |
39 | Halted | 0 ms | 0 KB | - |
# | 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 | 0 ms | 208 KB | Output is correct |
6 | Correct | 1 ms | 208 KB | Output is correct |
7 | Correct | 36 ms | 208 KB | Output is correct |
8 | Correct | 16 ms | 208 KB | Output is correct |
9 | Incorrect | 247 ms | 208 KB | Too many queries. |
10 | Halted | 0 ms | 0 KB | - |