# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
956141 | 2024-04-01T07:33:50 Z | n1k | 드문 곤충 (IOI22_insects) | C++17 | 91 ms | 1688 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; const int LOG = 12; int n; vector<set<int>> active(LOG); vector<int> v; void build(int lb, int rb, int level){ if(lb>=rb) return; int mb = (lb + rb) / 2; for(int i=lb; i<=mb; i++){ active[level].insert(v[i]); } build(lb, mb, level+1); build(mb+1, rb, level+1); } int min_cardinality(int N) { n = N; vector<int> rest; for(int i=0; i<n; i++){ move_inside(i); v.push_back(i); if(press_button()>=2){ move_outside(i); v.pop_back(); rest.push_back(i); } } build(0, v.size()-1, 0); int m=n-v.size(); vector<int> lb(m), rb(m, v.size()-1), count(v.size(), 1); set<int> cur(v.begin(), v.end()); for(int level=0; level<LOG; level++){ // activate for(auto x:active[level]){ if(not cur.count(x)){ cur.insert(x); move_inside(x); } } auto c_cur=cur;; // deactivate for(auto x:c_cur){ if(not active[level].count(x)){ cur.extract(x); move_outside(x); } } // query for(int i=0; i<m; i++){ if(lb[i]>=rb[i]) continue; int mb = (lb[i] + rb[i])/2; move_inside(rest[i]); if(press_button()==2){ rb[i]=mb; }else{ lb[i]=mb+1; } move_outside(rest[i]); } } for(int i=0; i<m; i++){ count[lb[i]]++; } return *min_element(count.begin(), count.end()); }
# | 결과 | 실행 시간 | 메모리 | 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 | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 600 KB | Output is correct |
8 | Correct | 7 ms | 852 KB | Output is correct |
9 | Correct | 4 ms | 856 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 6 ms | 600 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 856 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 340 KB | Output is correct |
16 | Correct | 5 ms | 600 KB | Output is correct |
17 | Correct | 5 ms | 600 KB | Output is correct |
18 | Correct | 4 ms | 600 KB | Output is correct |
19 | Correct | 5 ms | 600 KB | Output is correct |
20 | Correct | 5 ms | 344 KB | Output is correct |
21 | Correct | 4 ms | 344 KB | Output is correct |
22 | Correct | 3 ms | 600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 600 KB | Output is correct |
8 | Correct | 7 ms | 852 KB | Output is correct |
9 | Correct | 4 ms | 856 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 6 ms | 600 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 856 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 340 KB | Output is correct |
16 | Correct | 5 ms | 600 KB | Output is correct |
17 | Correct | 5 ms | 600 KB | Output is correct |
18 | Correct | 4 ms | 600 KB | Output is correct |
19 | Correct | 5 ms | 600 KB | Output is correct |
20 | Correct | 5 ms | 344 KB | Output is correct |
21 | Correct | 4 ms | 344 KB | Output is correct |
22 | Correct | 3 ms | 600 KB | Output is correct |
23 | Correct | 4 ms | 692 KB | Output is correct |
24 | Correct | 7 ms | 948 KB | Output is correct |
25 | Correct | 23 ms | 600 KB | Output is correct |
26 | Correct | 36 ms | 856 KB | Output is correct |
27 | Correct | 8 ms | 600 KB | Output is correct |
28 | Correct | 25 ms | 692 KB | Output is correct |
29 | Correct | 20 ms | 856 KB | Output is correct |
30 | Correct | 28 ms | 692 KB | Output is correct |
31 | Correct | 15 ms | 600 KB | Output is correct |
32 | Correct | 18 ms | 856 KB | Output is correct |
33 | Correct | 19 ms | 600 KB | Output is correct |
34 | Correct | 25 ms | 344 KB | Output is correct |
35 | Correct | 28 ms | 440 KB | Output is correct |
36 | Correct | 27 ms | 608 KB | Output is correct |
37 | Correct | 33 ms | 600 KB | Output is correct |
38 | Correct | 34 ms | 600 KB | Output is correct |
39 | Correct | 28 ms | 600 KB | Output is correct |
40 | Correct | 35 ms | 856 KB | Output is correct |
41 | Correct | 21 ms | 856 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 12 ms | 848 KB | Output is correct |
8 | Partially correct | 19 ms | 1372 KB | Output is partially correct |
9 | Partially correct | 64 ms | 1112 KB | Output is partially correct |
10 | Partially correct | 63 ms | 856 KB | Output is partially correct |
11 | Correct | 18 ms | 856 KB | Output is correct |
12 | Partially correct | 64 ms | 1524 KB | Output is partially correct |
13 | Partially correct | 35 ms | 848 KB | Output is partially correct |
14 | Partially correct | 59 ms | 856 KB | Output is partially correct |
15 | Partially correct | 40 ms | 692 KB | Output is partially correct |
16 | Partially correct | 46 ms | 856 KB | Output is partially correct |
17 | Partially correct | 38 ms | 844 KB | Output is partially correct |
18 | Partially correct | 44 ms | 600 KB | Output is partially correct |
19 | Partially correct | 52 ms | 700 KB | Output is partially correct |
20 | Partially correct | 54 ms | 436 KB | Output is partially correct |
21 | Partially correct | 74 ms | 856 KB | Output is partially correct |
22 | Partially correct | 87 ms | 852 KB | Output is partially correct |
23 | Partially correct | 86 ms | 1112 KB | Output is partially correct |
24 | Partially correct | 78 ms | 692 KB | Output is partially correct |
25 | Partially correct | 70 ms | 600 KB | Output is partially correct |
26 | Partially correct | 51 ms | 1436 KB | Output is partially correct |
27 | Partially correct | 76 ms | 856 KB | Output is partially correct |
28 | Partially correct | 65 ms | 856 KB | Output is partially correct |
29 | Partially correct | 67 ms | 856 KB | Output is partially correct |
30 | Partially correct | 52 ms | 600 KB | Output is partially correct |
31 | Partially correct | 75 ms | 856 KB | Output is partially correct |
32 | Partially correct | 62 ms | 600 KB | Output is partially correct |
33 | Partially correct | 79 ms | 692 KB | Output is partially correct |
34 | Partially correct | 80 ms | 856 KB | Output is partially correct |
35 | Partially correct | 63 ms | 600 KB | Output is partially correct |
36 | Partially correct | 59 ms | 696 KB | Output is partially correct |
37 | Partially correct | 68 ms | 604 KB | Output is partially correct |
38 | Partially correct | 63 ms | 676 KB | Output is partially correct |
39 | Partially correct | 91 ms | 864 KB | Output is partially correct |
40 | Partially correct | 69 ms | 604 KB | Output is partially correct |
41 | Partially correct | 91 ms | 856 KB | Output is partially correct |
42 | Partially correct | 81 ms | 600 KB | Output is partially correct |
43 | Partially correct | 10 ms | 600 KB | Output is partially correct |
44 | Partially correct | 33 ms | 592 KB | Output is partially correct |
45 | Correct | 16 ms | 1112 KB | Output is correct |
46 | Partially correct | 69 ms | 1436 KB | Output is partially correct |
47 | Partially correct | 50 ms | 944 KB | Output is partially correct |
48 | Partially correct | 66 ms | 1688 KB | Output is partially correct |