## 답안 #686414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
686414 2023-01-25T09:07:57 Z 79brue 드문 곤충 (IOI22_insects) C++17
61.06 / 100
152 ms 708 KB
```#include "insects.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k;
vector<int> vec;
bool isFirst[2002];
int type[2002], cnt[2002];
bool inside[2002];

void dnc(int l, int r, vector<int> &candidates){
if(l==r){
for(auto x: candidates) type[x] = vec[l];
return;
}
int m = (l+r)/2;
for(int i=l; i<=m; i++) if(!inside[vec[i]]) inside[vec[i]] = 1, move_inside(vec[i]);
for(int i=m+1; i<=r; i++) if(inside[vec[i]]) inside[vec[i]] = 0, move_outside(vec[i]);

vector<int> vecL, vecR;
for(auto x: candidates){
move_inside(x);
if(press_button() == 2) vecL.push_back(x);
else vecR.push_back(x);
move_outside(x);
}

dnc(l, m, vecL);
dnc(m+1, r, vecR);
}

int min_cardinality(int N){
n = N;

/// 종류 알아내기
for(int i=0; i<n; i++){
move_inside(i);
if(press_button() == 2) move_outside(i);
else vec.push_back(i), isFirst[i] = 1, inside[i] = 1, type[i] = i;
}

/// dnc 하기
k = (int)vec.size();
vector<int> notFirst;
for(int i=0; i<n; i++) if(!isFirst[i]) notFirst.push_back(i);
dnc(0, k-1, notFirst);

for(int i=0; i<n; i++) cnt[type[i]]++;
int ans = INT_MAX;
for(int i=0; i<n; i++) ans = min(ans, cnt[type[i]]);
return ans;
}
```

#### Subtask #1 10.0 / 10.0

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 3 ms 312 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 5 ms 208 KB Output is correct
9 Correct 9 ms 320 KB Output is correct
10 Correct 4 ms 312 KB Output is correct
11 Correct 8 ms 312 KB Output is correct
12 Correct 4 ms 316 KB Output is correct
13 Correct 9 ms 316 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Correct 11 ms 292 KB Output is correct
16 Correct 13 ms 208 KB Output is correct
17 Correct 9 ms 308 KB Output is correct
18 Correct 10 ms 300 KB Output is correct
19 Correct 12 ms 316 KB Output is correct
20 Correct 6 ms 320 KB Output is correct
21 Correct 12 ms 320 KB Output is correct
22 Correct 7 ms 296 KB Output is correct

#### Subtask #2 15.0 / 15.0

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 3 ms 312 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 5 ms 208 KB Output is correct
9 Correct 9 ms 320 KB Output is correct
10 Correct 4 ms 312 KB Output is correct
11 Correct 8 ms 312 KB Output is correct
12 Correct 4 ms 316 KB Output is correct
13 Correct 9 ms 316 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Correct 11 ms 292 KB Output is correct
16 Correct 13 ms 208 KB Output is correct
17 Correct 9 ms 308 KB Output is correct
18 Correct 10 ms 300 KB Output is correct
19 Correct 12 ms 316 KB Output is correct
20 Correct 6 ms 320 KB Output is correct
21 Correct 12 ms 320 KB Output is correct
22 Correct 7 ms 296 KB Output is correct
23 Correct 13 ms 328 KB Output is correct
24 Correct 14 ms 324 KB Output is correct
25 Correct 66 ms 308 KB Output is correct
26 Correct 59 ms 320 KB Output is correct
27 Correct 21 ms 312 KB Output is correct
28 Correct 56 ms 320 KB Output is correct
29 Correct 29 ms 308 KB Output is correct
30 Correct 46 ms 320 KB Output is correct
31 Correct 36 ms 308 KB Output is correct
32 Correct 39 ms 312 KB Output is correct
33 Correct 23 ms 308 KB Output is correct
34 Correct 22 ms 308 KB Output is correct
35 Correct 54 ms 308 KB Output is correct
36 Correct 24 ms 312 KB Output is correct
37 Correct 39 ms 312 KB Output is correct
38 Correct 39 ms 304 KB Output is correct
39 Correct 58 ms 308 KB Output is correct
40 Correct 28 ms 316 KB Output is correct
41 Correct 40 ms 308 KB Output is correct

#### Subtask #3 36.06 / 75.0

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 12 ms 208 KB Output is correct
8 Partially correct 20 ms 368 KB Output is partially correct
9 Partially correct 100 ms 324 KB Output is partially correct
10 Partially correct 124 ms 332 KB Output is partially correct
11 Correct 31 ms 296 KB Output is correct
12 Partially correct 104 ms 708 KB Output is partially correct
13 Partially correct 61 ms 308 KB Output is partially correct
14 Partially correct 53 ms 308 KB Output is partially correct
15 Partially correct 66 ms 308 KB Output is partially correct
16 Partially correct 59 ms 312 KB Output is partially correct
17 Partially correct 35 ms 304 KB Output is partially correct
18 Partially correct 89 ms 324 KB Output is partially correct
19 Partially correct 81 ms 420 KB Output is partially correct
20 Partially correct 78 ms 304 KB Output is partially correct
21 Partially correct 53 ms 316 KB Output is partially correct
22 Partially correct 126 ms 328 KB Output is partially correct
23 Partially correct 152 ms 444 KB Output is partially correct
24 Partially correct 106 ms 320 KB Output is partially correct
25 Partially correct 128 ms 320 KB Output is partially correct
26 Partially correct 96 ms 440 KB Output is partially correct
27 Partially correct 66 ms 316 KB Output is partially correct
28 Partially correct 110 ms 316 KB Output is partially correct
29 Partially correct 119 ms 300 KB Output is partially correct
30 Partially correct 119 ms 304 KB Output is partially correct
31 Partially correct 123 ms 300 KB Output is partially correct
32 Partially correct 125 ms 320 KB Output is partially correct
33 Partially correct 98 ms 420 KB Output is partially correct
34 Partially correct 114 ms 308 KB Output is partially correct
35 Partially correct 134 ms 316 KB Output is partially correct
36 Partially correct 113 ms 356 KB Output is partially correct
37 Partially correct 109 ms 312 KB Output is partially correct
38 Partially correct 136 ms 316 KB Output is partially correct
39 Partially correct 148 ms 436 KB Output is partially correct
40 Partially correct 106 ms 208 KB Output is partially correct
41 Partially correct 66 ms 568 KB Output is partially correct
42 Partially correct 113 ms 316 KB Output is partially correct
43 Partially correct 24 ms 336 KB Output is partially correct
44 Partially correct 79 ms 436 KB Output is partially correct
45 Correct 37 ms 300 KB Output is correct
46 Partially correct 105 ms 448 KB Output is partially correct
47 Partially correct 101 ms 432 KB Output is partially correct
48 Partially correct 103 ms 308 KB Output is partially correct