# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1113732 | 2024-11-17T08:59:13 Z | db_123 | 드문 곤충 (IOI22_insects) | C++17 | 122 ms | 844 KB |
#include "insects.h" #include <vector> #include <set> #include <unordered_map> using namespace std; int n; void check(int N, int d, int &always_add, int &rsBs, vector<bool> &vis) { int mid = N / (2 * d); if(mid == 0) mid = 1; vector<int> poz; for (int i = 1; i <= n; i++) { if (vis[i]) { continue; } move_inside(i - 1); if (press_button() > mid) { move_outside(i - 1); continue; } poz.emplace_back(i); } for (auto it : poz) { move_outside(it - 1); } if (poz.size() == mid * d) { /// e plin for (auto it : poz) { vis[it] = true; } always_add += poz.size() / d; } else if (poz.size() < mid * d) { /// nu e plin rsBs = min(rsBs, mid); int idx = 0; for (int i = 1; i <= n; i++) { if (vis[i]) { continue; } while (idx < poz.size() && poz[idx] < i) { idx ++; } if (poz[idx] != i) { vis[i] = true; } } } return; } int min_cardinality(int N) { vector<bool> vis(N + 1); n = N; int d = 0; { vector<int> temp; for (int i = 1; i <= n; i++) { move_inside(i - 1); if (press_button() > 1) { move_outside(i - 1); continue; } temp.emplace_back(i); } d = temp.size(); for (auto it : temp) { move_outside(it - 1); } } int always_add = 0, rsBs = 1e9; while (N >= d) { check(N, d, always_add, rsBs, vis); int cnt = 0; for (int i = 1; i <= n; i++) { if (vis[i]) { continue; } cnt ++; } N = cnt; } return always_add; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 13 ms | 336 KB | Output is correct |
7 | Correct | 7 ms | 336 KB | Output is correct |
8 | Correct | 9 ms | 336 KB | Output is correct |
9 | Correct | 12 ms | 336 KB | Output is correct |
10 | Correct | 8 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 336 KB | Output is correct |
12 | Correct | 10 ms | 336 KB | Output is correct |
13 | Correct | 9 ms | 336 KB | Output is correct |
14 | Correct | 10 ms | 336 KB | Output is correct |
15 | Correct | 8 ms | 336 KB | Output is correct |
16 | Correct | 10 ms | 336 KB | Output is correct |
17 | Correct | 9 ms | 336 KB | Output is correct |
18 | Correct | 8 ms | 336 KB | Output is correct |
19 | Correct | 9 ms | 336 KB | Output is correct |
20 | Correct | 8 ms | 336 KB | Output is correct |
21 | Correct | 6 ms | 336 KB | Output is correct |
22 | Correct | 7 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 13 ms | 336 KB | Output is correct |
7 | Correct | 7 ms | 336 KB | Output is correct |
8 | Correct | 9 ms | 336 KB | Output is correct |
9 | Correct | 12 ms | 336 KB | Output is correct |
10 | Correct | 8 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 336 KB | Output is correct |
12 | Correct | 10 ms | 336 KB | Output is correct |
13 | Correct | 9 ms | 336 KB | Output is correct |
14 | Correct | 10 ms | 336 KB | Output is correct |
15 | Correct | 8 ms | 336 KB | Output is correct |
16 | Correct | 10 ms | 336 KB | Output is correct |
17 | Correct | 9 ms | 336 KB | Output is correct |
18 | Correct | 8 ms | 336 KB | Output is correct |
19 | Correct | 9 ms | 336 KB | Output is correct |
20 | Correct | 8 ms | 336 KB | Output is correct |
21 | Correct | 6 ms | 336 KB | Output is correct |
22 | Correct | 7 ms | 336 KB | Output is correct |
23 | Correct | 47 ms | 416 KB | Output is correct |
24 | Correct | 26 ms | 436 KB | Output is correct |
25 | Correct | 50 ms | 336 KB | Output is correct |
26 | Correct | 41 ms | 336 KB | Output is correct |
27 | Correct | 31 ms | 336 KB | Output is correct |
28 | Correct | 23 ms | 592 KB | Output is correct |
29 | Correct | 45 ms | 592 KB | Output is correct |
30 | Correct | 49 ms | 584 KB | Output is correct |
31 | Correct | 50 ms | 336 KB | Output is correct |
32 | Correct | 50 ms | 428 KB | Output is correct |
33 | Correct | 52 ms | 504 KB | Output is correct |
34 | Correct | 49 ms | 336 KB | Output is correct |
35 | Correct | 49 ms | 336 KB | Output is correct |
36 | Correct | 47 ms | 424 KB | Output is correct |
37 | Correct | 58 ms | 420 KB | Output is correct |
38 | Correct | 53 ms | 584 KB | Output is correct |
39 | Correct | 36 ms | 336 KB | Output is correct |
40 | Correct | 34 ms | 424 KB | Output is correct |
41 | Correct | 27 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Partially correct | 2 ms | 336 KB | Output is partially correct |
7 | Correct | 102 ms | 412 KB | Output is correct |
8 | Correct | 65 ms | 676 KB | Output is correct |
9 | Partially correct | 116 ms | 844 KB | Output is partially correct |
10 | Correct | 96 ms | 336 KB | Output is correct |
11 | Correct | 78 ms | 416 KB | Output is correct |
12 | Correct | 89 ms | 580 KB | Output is correct |
13 | Correct | 92 ms | 416 KB | Output is correct |
14 | Correct | 101 ms | 412 KB | Output is correct |
15 | Correct | 106 ms | 424 KB | Output is correct |
16 | Partially correct | 106 ms | 684 KB | Output is partially correct |
17 | Correct | 95 ms | 672 KB | Output is correct |
18 | Correct | 104 ms | 412 KB | Output is correct |
19 | Correct | 100 ms | 676 KB | Output is correct |
20 | Correct | 107 ms | 840 KB | Output is correct |
21 | Correct | 100 ms | 676 KB | Output is correct |
22 | Correct | 92 ms | 416 KB | Output is correct |
23 | Correct | 91 ms | 592 KB | Output is correct |
24 | Correct | 95 ms | 592 KB | Output is correct |
25 | Correct | 86 ms | 592 KB | Output is correct |
26 | Correct | 61 ms | 592 KB | Output is correct |
27 | Partially correct | 114 ms | 584 KB | Output is partially correct |
28 | Partially correct | 119 ms | 424 KB | Output is partially correct |
29 | Partially correct | 122 ms | 428 KB | Output is partially correct |
30 | Partially correct | 112 ms | 424 KB | Output is partially correct |
31 | Correct | 97 ms | 420 KB | Output is correct |
32 | Correct | 111 ms | 668 KB | Output is correct |
33 | Correct | 94 ms | 420 KB | Output is correct |
34 | Correct | 100 ms | 416 KB | Output is correct |
35 | Partially correct | 114 ms | 428 KB | Output is partially correct |
36 | Partially correct | 113 ms | 840 KB | Output is partially correct |
37 | Correct | 104 ms | 840 KB | Output is correct |
38 | Correct | 115 ms | 692 KB | Output is correct |
39 | Partially correct | 108 ms | 424 KB | Output is partially correct |
40 | Partially correct | 115 ms | 508 KB | Output is partially correct |
41 | Partially correct | 104 ms | 584 KB | Output is partially correct |
42 | Partially correct | 105 ms | 504 KB | Output is partially correct |
43 | Correct | 18 ms | 336 KB | Output is correct |
44 | Correct | 69 ms | 588 KB | Output is correct |
45 | Correct | 105 ms | 672 KB | Output is correct |
46 | Correct | 76 ms | 424 KB | Output is correct |
47 | Correct | 75 ms | 336 KB | Output is correct |
48 | Correct | 79 ms | 580 KB | Output is correct |