# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070852 | 2024-08-22T19:44:00 Z | JoenPoenMan | Rarest Insects (IOI22_insects) | C++17 | 249 ms | 672 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 > 20) { 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 | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 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 | 3 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 | 344 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 4 ms | 344 KB | Output is correct |
15 | Correct | 5 ms | 344 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 4 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 344 KB | Output is correct |
20 | Incorrect | 243 ms | 344 KB | Too many queries. |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 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 | 3 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 | 344 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 4 ms | 344 KB | Output is correct |
15 | Correct | 5 ms | 344 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 4 ms | 344 KB | Output is correct |
19 | Correct | 4 ms | 344 KB | Output is correct |
20 | Incorrect | 243 ms | 344 KB | Too many queries. |
21 | Halted | 0 ms | 0 KB | - |
# | 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 | Partially correct | 0 ms | 344 KB | Output is partially correct |
7 | Partially correct | 27 ms | 420 KB | Output is partially correct |
8 | Correct | 22 ms | 672 KB | Output is correct |
9 | Correct | 26 ms | 344 KB | Output is correct |
10 | Incorrect | 249 ms | 344 KB | Too many queries. |
11 | Halted | 0 ms | 0 KB | - |