# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1057094 | 2024-08-13T14:05:02 Z | vjudge1 | 드문 곤충 (IOI22_insects) | C++17 | 185 ms | 1124 KB |
#include "insects.h" #include <bits/stdc++.h> using namespace std; using vi = vector<int>; using ii = pair<int, int>; set<int> Cur, Vreau; void movein2(int v) { Vreau.insert(v); } void moveout2(int v) { Vreau.erase(v); } int press2() { vi scos, add; for(auto it : Cur) { if(!Vreau.count(it)) scos.push_back(it); } for(auto it : Vreau) if(!Cur.count(it)) add.push_back(it); for(auto it : add) move_inside(it); for(auto it : scos) move_outside(it); Cur = Vreau; return press_button(); } int min_cardinality(int n) { int d = 0; vi Cul; for(int i = 0; i < n; ++i) { movein2(i); if(press2() == 1) { Cul.push_back(i); ++d; } else moveout2(i); } for(auto it : Cul) moveout2(it); int re = 0; int st = 1, dr = n / d, mij; set<int> S; for(int i = 0; i < n; ++i) S.insert(i); while(st < dr) { mij = (st + dr + 1) / 2; if(d > S.size()) { st = dr = 0; break; // exista 0! } set<int> I; for(auto it : S) { if(I.size() == d * mij) break; movein2(it); if(press2() == mij + 1) { moveout2(it); } else { I.insert(it); } } if(I.size() == d * mij) { for(auto it : I) { S.erase(it); } re += mij; st = 0; dr = dr - mij; } else { dr = mij - 1; S = I; } for(auto it : I) moveout2(it); } return re + st; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 432 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 432 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 2 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 344 KB | Output is correct |
16 | Correct | 2 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 3 ms | 344 KB | Output is correct |
19 | Correct | 3 ms | 344 KB | Output is correct |
20 | Correct | 3 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 696 KB | Output is correct |
22 | Correct | 1 ms | 344 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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 432 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 3 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 432 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 2 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 344 KB | Output is correct |
16 | Correct | 2 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 3 ms | 344 KB | Output is correct |
19 | Correct | 3 ms | 344 KB | Output is correct |
20 | Correct | 3 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 696 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 13 ms | 600 KB | Output is correct |
24 | Correct | 22 ms | 600 KB | Output is correct |
25 | Correct | 22 ms | 344 KB | Output is correct |
26 | Correct | 23 ms | 344 KB | Output is correct |
27 | Correct | 17 ms | 488 KB | Output is correct |
28 | Correct | 15 ms | 344 KB | Output is correct |
29 | Correct | 22 ms | 600 KB | Output is correct |
30 | Correct | 26 ms | 436 KB | Output is correct |
31 | Correct | 14 ms | 340 KB | Output is correct |
32 | Correct | 15 ms | 344 KB | Output is correct |
33 | Correct | 22 ms | 436 KB | Output is correct |
34 | Correct | 16 ms | 340 KB | Output is correct |
35 | Correct | 22 ms | 936 KB | Output is correct |
36 | Correct | 20 ms | 592 KB | Output is correct |
37 | Correct | 28 ms | 600 KB | Output is correct |
38 | Correct | 37 ms | 516 KB | Output is correct |
39 | Correct | 37 ms | 692 KB | Output is correct |
40 | Correct | 29 ms | 704 KB | Output is correct |
41 | Correct | 21 ms | 480 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 368 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 | 0 ms | 344 KB | Output is correct |
7 | Correct | 36 ms | 608 KB | Output is correct |
8 | Correct | 144 ms | 608 KB | Output is correct |
9 | Correct | 76 ms | 732 KB | Output is correct |
10 | Correct | 103 ms | 432 KB | Output is correct |
11 | Correct | 54 ms | 440 KB | Output is correct |
12 | Correct | 83 ms | 752 KB | Output is correct |
13 | Correct | 74 ms | 600 KB | Output is correct |
14 | Correct | 100 ms | 848 KB | Output is correct |
15 | Correct | 42 ms | 588 KB | Output is correct |
16 | Correct | 63 ms | 668 KB | Output is correct |
17 | Correct | 60 ms | 644 KB | Output is correct |
18 | Correct | 65 ms | 712 KB | Output is correct |
19 | Correct | 53 ms | 828 KB | Output is correct |
20 | Correct | 69 ms | 428 KB | Output is correct |
21 | Correct | 85 ms | 1124 KB | Output is correct |
22 | Partially correct | 107 ms | 788 KB | Output is partially correct |
23 | Correct | 115 ms | 688 KB | Output is correct |
24 | Correct | 161 ms | 484 KB | Output is correct |
25 | Correct | 143 ms | 504 KB | Output is correct |
26 | Correct | 65 ms | 344 KB | Output is correct |
27 | Correct | 91 ms | 600 KB | Output is correct |
28 | Correct | 40 ms | 592 KB | Output is correct |
29 | Partially correct | 99 ms | 592 KB | Output is partially correct |
30 | Partially correct | 111 ms | 588 KB | Output is partially correct |
31 | Correct | 132 ms | 592 KB | Output is correct |
32 | Correct | 87 ms | 848 KB | Output is correct |
33 | Correct | 116 ms | 600 KB | Output is correct |
34 | Correct | 154 ms | 536 KB | Output is correct |
35 | Partially correct | 112 ms | 592 KB | Output is partially correct |
36 | Correct | 56 ms | 588 KB | Output is correct |
37 | Correct | 110 ms | 600 KB | Output is correct |
38 | Correct | 87 ms | 724 KB | Output is correct |
39 | Correct | 117 ms | 708 KB | Output is correct |
40 | Correct | 47 ms | 436 KB | Output is correct |
41 | Correct | 70 ms | 748 KB | Output is correct |
42 | Partially correct | 122 ms | 736 KB | Output is partially correct |
43 | Correct | 7 ms | 344 KB | Output is correct |
44 | Correct | 40 ms | 796 KB | Output is correct |
45 | Correct | 36 ms | 600 KB | Output is correct |
46 | Correct | 66 ms | 588 KB | Output is correct |
47 | Correct | 185 ms | 624 KB | Output is correct |
48 | Correct | 108 ms | 440 KB | Output is correct |