# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
783114 | 2023-07-14T15:35:52 Z | mousebeaver | 드문 곤충 (IOI22_insects) | C++17 | 104 ms | 408 KB |
#include <bits/stdc++.h> #include "insects.h" #define pii pair<int, int> using namespace std; set<pii> inside; set<pii> outside; //Random key, insect index int types = -1; int countTypes() { int pb = press_button(); while(inside.size() && pb > 1) { for(int i = pb; i > 1; i--) { move_outside((*inside.begin()).second); outside.insert(*inside.begin()); inside.erase(inside.begin()); } pb = press_button(); } vector<pii> a(0); for(pii i : outside) { a.push_back(i); } for(pii i : a) { move_inside(i.second); inside.insert(i); outside.erase(i); if(inside.size() > 1 && press_button() > 1) { move_outside(i.second); outside.insert(i); inside.erase(i); } } return inside.size(); } bool test(int k) //Every type at least k insects? { int pb = press_button(); while(pb > k) { for(int i = pb; i > k; i--) { move_outside((*inside.begin()).second); outside.insert(*inside.begin()); inside.erase(inside.begin()); } pb = press_button(); } vector<pii> a(0); for(pii i : outside) { a.push_back(i); } for(pii i : a) { move_inside(i.second); inside.insert(i); outside.erase(i); if((int) inside.size() > k) { if(press_button() > k) { move_outside(i.second); outside.insert(i); inside.erase(i); } } } return((int) inside.size() == k*types); } int min_cardinality(int N) { srand(43); for(int i = 0; i < N; i++) { outside.insert({rand()%100000, i}); } types = countTypes(); if(types <= 5) { while(inside.size()) { move_outside((*inside.begin()).second); outside.insert(*inside.begin()); inside.erase(inside.begin()); } vector<int> a(N); int counter = 0; for(pii p : outside) { a[counter] = p.second; counter++; } vector<int> card(N, -1); for(int i = 0; i < N; i++) { if(card[a[i]] == -1) { move_inside(a[i]); vector<int> machine = {a[i]}; for(int j = i+1; j < N; j++) { if(card[a[j]] == -1) { move_inside(a[j]); machine.push_back(a[j]); int state = press_button(); if(state != (int) machine.size()) { move_outside(a[j]); machine.pop_back(); } } } for(int j : machine) { card[j] = machine.size(); move_outside(j); } } } return *min_element(card.begin(), card.end()); } int left = 1; int right = N/types; while(left < right) { int mid = (left+right+1)/2; if(right-left > 10) { mid = left + (right-left)/4; } if(test(mid)) { left = mid; } else { right = mid-1; } } return left; }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 208 KB | Output is correct |
7 | Correct | 2 ms | 208 KB | Output is correct |
8 | Correct | 7 ms | 208 KB | Output is correct |
9 | Correct | 7 ms | 208 KB | Output is correct |
10 | Correct | 4 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 6 ms | 208 KB | Output is correct |
13 | Correct | 6 ms | 208 KB | Output is correct |
14 | Correct | 8 ms | 208 KB | Output is correct |
15 | Correct | 8 ms | 308 KB | Output is correct |
16 | Correct | 9 ms | 208 KB | Output is correct |
17 | Correct | 7 ms | 208 KB | Output is correct |
18 | Correct | 5 ms | 208 KB | Output is correct |
19 | Correct | 3 ms | 208 KB | Output is correct |
20 | Correct | 6 ms | 208 KB | Output is correct |
21 | Correct | 2 ms | 208 KB | Output is correct |
22 | Correct | 3 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 208 KB | Output is correct |
7 | Correct | 2 ms | 208 KB | Output is correct |
8 | Correct | 7 ms | 208 KB | Output is correct |
9 | Correct | 7 ms | 208 KB | Output is correct |
10 | Correct | 4 ms | 208 KB | Output is correct |
11 | Correct | 2 ms | 208 KB | Output is correct |
12 | Correct | 6 ms | 208 KB | Output is correct |
13 | Correct | 6 ms | 208 KB | Output is correct |
14 | Correct | 8 ms | 208 KB | Output is correct |
15 | Correct | 8 ms | 308 KB | Output is correct |
16 | Correct | 9 ms | 208 KB | Output is correct |
17 | Correct | 7 ms | 208 KB | Output is correct |
18 | Correct | 5 ms | 208 KB | Output is correct |
19 | Correct | 3 ms | 208 KB | Output is correct |
20 | Correct | 6 ms | 208 KB | Output is correct |
21 | Correct | 2 ms | 208 KB | Output is correct |
22 | Correct | 3 ms | 208 KB | Output is correct |
23 | Correct | 15 ms | 336 KB | Output is correct |
24 | Correct | 7 ms | 336 KB | Output is correct |
25 | Correct | 40 ms | 344 KB | Output is correct |
26 | Correct | 42 ms | 336 KB | Output is correct |
27 | Correct | 12 ms | 336 KB | Output is correct |
28 | Correct | 8 ms | 336 KB | Output is correct |
29 | Correct | 14 ms | 400 KB | Output is correct |
30 | Correct | 37 ms | 360 KB | Output is correct |
31 | Correct | 38 ms | 336 KB | Output is correct |
32 | Correct | 34 ms | 336 KB | Output is correct |
33 | Correct | 44 ms | 364 KB | Output is correct |
34 | Correct | 31 ms | 336 KB | Output is correct |
35 | Correct | 41 ms | 336 KB | Output is correct |
36 | Correct | 34 ms | 336 KB | Output is correct |
37 | Correct | 42 ms | 336 KB | Output is correct |
38 | Correct | 30 ms | 364 KB | Output is correct |
39 | Correct | 30 ms | 336 KB | Output is correct |
40 | Correct | 10 ms | 336 KB | Output is correct |
41 | Correct | 9 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 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 | 0 ms | 208 KB | Output is correct |
7 | Correct | 31 ms | 404 KB | Output is correct |
8 | Correct | 10 ms | 336 KB | Output is correct |
9 | Partially correct | 70 ms | 336 KB | Output is partially correct |
10 | Partially correct | 81 ms | 336 KB | Output is partially correct |
11 | Correct | 28 ms | 336 KB | Output is correct |
12 | Correct | 25 ms | 336 KB | Output is correct |
13 | Partially correct | 59 ms | 408 KB | Output is partially correct |
14 | Partially correct | 62 ms | 384 KB | Output is partially correct |
15 | Partially correct | 57 ms | 336 KB | Output is partially correct |
16 | Partially correct | 93 ms | 336 KB | Output is partially correct |
17 | Partially correct | 104 ms | 336 KB | Output is partially correct |
18 | Partially correct | 80 ms | 336 KB | Output is partially correct |
19 | Partially correct | 60 ms | 392 KB | Output is partially correct |
20 | Partially correct | 89 ms | 336 KB | Output is partially correct |
21 | Partially correct | 57 ms | 336 KB | Output is partially correct |
22 | Partially correct | 84 ms | 336 KB | Output is partially correct |
23 | Partially correct | 51 ms | 336 KB | Output is partially correct |
24 | Partially correct | 47 ms | 336 KB | Output is partially correct |
25 | Correct | 20 ms | 336 KB | Output is correct |
26 | Correct | 18 ms | 336 KB | Output is correct |
27 | Partially correct | 55 ms | 336 KB | Output is partially correct |
28 | Partially correct | 58 ms | 336 KB | Output is partially correct |
29 | Partially correct | 82 ms | 336 KB | Output is partially correct |
30 | Partially correct | 87 ms | 336 KB | Output is partially correct |
31 | Partially correct | 74 ms | 336 KB | Output is partially correct |
32 | Partially correct | 68 ms | 336 KB | Output is partially correct |
33 | Partially correct | 54 ms | 336 KB | Output is partially correct |
34 | Partially correct | 82 ms | 336 KB | Output is partially correct |
35 | Partially correct | 79 ms | 336 KB | Output is partially correct |
36 | Partially correct | 80 ms | 336 KB | Output is partially correct |
37 | Partially correct | 81 ms | 336 KB | Output is partially correct |
38 | Partially correct | 81 ms | 336 KB | Output is partially correct |
39 | Partially correct | 66 ms | 336 KB | Output is partially correct |
40 | Partially correct | 75 ms | 336 KB | Output is partially correct |
41 | Partially correct | 71 ms | 336 KB | Output is partially correct |
42 | Partially correct | 75 ms | 336 KB | Output is partially correct |
43 | Partially correct | 24 ms | 208 KB | Output is partially correct |
44 | Partially correct | 88 ms | 336 KB | Output is partially correct |
45 | Correct | 47 ms | 336 KB | Output is correct |
46 | Correct | 28 ms | 336 KB | Output is correct |
47 | Correct | 25 ms | 336 KB | Output is correct |
48 | Correct | 17 ms | 336 KB | Output is correct |