# | Submission time^{} |
Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|

686416 | 2023-01-25T09:08:58 Z | 79brue | Rarest Insects (IOI22_insects) | C++17 | 155 ms | 484 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(candidates.empty()) return; 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; }

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 0 ms | 208 KB | Output is correct |

2 | Correct | 1 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 | 1 ms | 208 KB | Output is correct |

6 | Correct | 2 ms | 208 KB | Output is correct |

7 | Correct | 2 ms | 312 KB | Output is correct |

8 | Correct | 9 ms | 208 KB | Output is correct |

9 | Correct | 8 ms | 208 KB | Output is correct |

10 | Correct | 5 ms | 208 KB | Output is correct |

11 | Correct | 9 ms | 312 KB | Output is correct |

12 | Correct | 7 ms | 316 KB | Output is correct |

13 | Correct | 8 ms | 208 KB | Output is correct |

14 | Correct | 8 ms | 208 KB | Output is correct |

15 | Correct | 11 ms | 336 KB | Output is correct |

16 | Correct | 9 ms | 336 KB | Output is correct |

17 | Correct | 10 ms | 312 KB | Output is correct |

18 | Correct | 7 ms | 312 KB | Output is correct |

19 | Correct | 11 ms | 316 KB | Output is correct |

20 | Correct | 11 ms | 208 KB | Output is correct |

21 | Correct | 8 ms | 308 KB | Output is correct |

22 | Correct | 6 ms | 320 KB | Output is correct |

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 0 ms | 208 KB | Output is correct |

2 | Correct | 1 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 | 1 ms | 208 KB | Output is correct |

6 | Correct | 2 ms | 208 KB | Output is correct |

7 | Correct | 2 ms | 312 KB | Output is correct |

8 | Correct | 9 ms | 208 KB | Output is correct |

9 | Correct | 8 ms | 208 KB | Output is correct |

10 | Correct | 5 ms | 208 KB | Output is correct |

11 | Correct | 9 ms | 312 KB | Output is correct |

12 | Correct | 7 ms | 316 KB | Output is correct |

13 | Correct | 8 ms | 208 KB | Output is correct |

14 | Correct | 8 ms | 208 KB | Output is correct |

15 | Correct | 11 ms | 336 KB | Output is correct |

16 | Correct | 9 ms | 336 KB | Output is correct |

17 | Correct | 10 ms | 312 KB | Output is correct |

18 | Correct | 7 ms | 312 KB | Output is correct |

19 | Correct | 11 ms | 316 KB | Output is correct |

20 | Correct | 11 ms | 208 KB | Output is correct |

21 | Correct | 8 ms | 308 KB | Output is correct |

22 | Correct | 6 ms | 320 KB | Output is correct |

23 | Correct | 9 ms | 208 KB | Output is correct |

24 | Correct | 10 ms | 320 KB | Output is correct |

25 | Correct | 44 ms | 300 KB | Output is correct |

26 | Correct | 43 ms | 304 KB | Output is correct |

27 | Correct | 17 ms | 312 KB | Output is correct |

28 | Correct | 46 ms | 308 KB | Output is correct |

29 | Correct | 26 ms | 208 KB | Output is correct |

30 | Correct | 43 ms | 440 KB | Output is correct |

31 | Correct | 29 ms | 304 KB | Output is correct |

32 | Correct | 17 ms | 208 KB | Output is correct |

33 | Correct | 43 ms | 308 KB | Output is correct |

34 | Correct | 44 ms | 304 KB | Output is correct |

35 | Correct | 24 ms | 336 KB | Output is correct |

36 | Correct | 49 ms | 300 KB | Output is correct |

37 | Correct | 63 ms | 308 KB | Output is correct |

38 | Correct | 59 ms | 316 KB | Output is correct |

39 | Correct | 54 ms | 328 KB | Output is correct |

40 | Correct | 61 ms | 308 KB | Output is correct |

41 | Correct | 36 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 | 1 ms | 208 KB | Output is correct |

4 | Correct | 0 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 | 16 ms | 304 KB | Output is correct |

8 | Correct | 20 ms | 436 KB | Output is correct |

9 | Partially correct | 121 ms | 392 KB | Output is partially correct |

10 | Partially correct | 116 ms | 324 KB | Output is partially correct |

11 | Correct | 36 ms | 320 KB | Output is correct |

12 | Partially correct | 116 ms | 484 KB | Output is partially correct |

13 | Partially correct | 73 ms | 324 KB | Output is partially correct |

14 | Partially correct | 72 ms | 452 KB | Output is partially correct |

15 | Partially correct | 73 ms | 320 KB | Output is partially correct |

16 | Partially correct | 78 ms | 292 KB | Output is partially correct |

17 | Partially correct | 94 ms | 296 KB | Output is partially correct |

18 | Partially correct | 69 ms | 304 KB | Output is partially correct |

19 | Partially correct | 78 ms | 328 KB | Output is partially correct |

20 | Partially correct | 84 ms | 324 KB | Output is partially correct |

21 | Partially correct | 139 ms | 328 KB | Output is partially correct |

22 | Partially correct | 136 ms | 208 KB | Output is partially correct |

23 | Partially correct | 155 ms | 320 KB | Output is partially correct |

24 | Partially correct | 143 ms | 320 KB | Output is partially correct |

25 | Partially correct | 136 ms | 316 KB | Output is partially correct |

26 | Partially correct | 79 ms | 312 KB | Output is partially correct |

27 | Partially correct | 122 ms | 304 KB | Output is partially correct |

28 | Partially correct | 57 ms | 428 KB | Output is partially correct |

29 | Partially correct | 114 ms | 304 KB | Output is partially correct |

30 | Partially correct | 109 ms | 312 KB | Output is partially correct |

31 | Partially correct | 78 ms | 316 KB | Output is partially correct |

32 | Partially correct | 96 ms | 320 KB | Output is partially correct |

33 | Partially correct | 151 ms | 324 KB | Output is partially correct |

34 | Partially correct | 134 ms | 320 KB | Output is partially correct |

35 | Partially correct | 126 ms | 436 KB | Output is partially correct |

36 | Partially correct | 124 ms | 332 KB | Output is partially correct |

37 | Partially correct | 133 ms | 320 KB | Output is partially correct |

38 | Partially correct | 98 ms | 316 KB | Output is partially correct |

39 | Partially correct | 124 ms | 300 KB | Output is partially correct |

40 | Partially correct | 137 ms | 300 KB | Output is partially correct |

41 | Partially correct | 144 ms | 452 KB | Output is partially correct |

42 | Partially correct | 112 ms | 320 KB | Output is partially correct |

43 | Partially correct | 21 ms | 316 KB | Output is partially correct |

44 | Partially correct | 82 ms | 312 KB | Output is partially correct |

45 | Correct | 38 ms | 308 KB | Output is correct |

46 | Partially correct | 93 ms | 356 KB | Output is partially correct |

47 | Partially correct | 52 ms | 348 KB | Output is partially correct |

48 | Partially correct | 84 ms | 444 KB | Output is partially correct |