# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1057087 | 2024-08-13T14:03:03 Z | vjudge1 | 드문 곤충 (IOI22_insects) | C++17 | 299 ms | 876 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 = 0, 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) { 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 | 3 ms | 432 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |
8 | Correct | 3 ms | 344 KB | Output is correct |
9 | Correct | 5 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 | 344 KB | Output is correct |
13 | Correct | 4 ms | 440 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 4 ms | 344 KB | Output is correct |
18 | Correct | 3 ms | 444 KB | Output is correct |
19 | Correct | 3 ms | 344 KB | Output is correct |
20 | Correct | 2 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 344 KB | Output is correct |
22 | Correct | 3 ms | 460 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 | 3 ms | 432 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |
8 | Correct | 3 ms | 344 KB | Output is correct |
9 | Correct | 5 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 | 344 KB | Output is correct |
13 | Correct | 4 ms | 440 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 4 ms | 344 KB | Output is correct |
18 | Correct | 3 ms | 444 KB | Output is correct |
19 | Correct | 3 ms | 344 KB | Output is correct |
20 | Correct | 2 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 344 KB | Output is correct |
22 | Correct | 3 ms | 460 KB | Output is correct |
23 | Correct | 29 ms | 536 KB | Output is correct |
24 | Correct | 43 ms | 772 KB | Output is correct |
25 | Correct | 26 ms | 436 KB | Output is correct |
26 | Correct | 24 ms | 340 KB | Output is correct |
27 | Correct | 20 ms | 432 KB | Output is correct |
28 | Correct | 24 ms | 740 KB | Output is correct |
29 | Correct | 26 ms | 344 KB | Output is correct |
30 | Correct | 25 ms | 344 KB | Output is correct |
31 | Correct | 27 ms | 344 KB | Output is correct |
32 | Correct | 24 ms | 592 KB | Output is correct |
33 | Correct | 27 ms | 688 KB | Output is correct |
34 | Correct | 26 ms | 344 KB | Output is correct |
35 | Correct | 29 ms | 436 KB | Output is correct |
36 | Correct | 29 ms | 344 KB | Output is correct |
37 | Correct | 29 ms | 444 KB | Output is correct |
38 | Correct | 30 ms | 548 KB | Output is correct |
39 | Correct | 30 ms | 600 KB | Output is correct |
40 | Correct | 29 ms | 516 KB | Output is correct |
41 | Correct | 32 ms | 592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 96 ms | 552 KB | Output is correct |
8 | Correct | 299 ms | 820 KB | Output is correct |
9 | Correct | 117 ms | 600 KB | Output is correct |
10 | Correct | 88 ms | 876 KB | Output is correct |
11 | Correct | 51 ms | 428 KB | Output is correct |
12 | Correct | 95 ms | 588 KB | Output is correct |
13 | Correct | 87 ms | 592 KB | Output is correct |
14 | Correct | 89 ms | 600 KB | Output is correct |
15 | Correct | 96 ms | 592 KB | Output is correct |
16 | Correct | 103 ms | 600 KB | Output is correct |
17 | Correct | 102 ms | 700 KB | Output is correct |
18 | Correct | 96 ms | 580 KB | Output is correct |
19 | Partially correct | 115 ms | 772 KB | Output is partially correct |
20 | Correct | 94 ms | 600 KB | Output is correct |
21 | Correct | 101 ms | 764 KB | Output is correct |
22 | Correct | 104 ms | 592 KB | Output is correct |
23 | Correct | 98 ms | 700 KB | Output is correct |
24 | Correct | 102 ms | 592 KB | Output is correct |
25 | Correct | 120 ms | 848 KB | Output is correct |
26 | Correct | 143 ms | 840 KB | Output is correct |
27 | Partially correct | 102 ms | 592 KB | Output is partially correct |
28 | Partially correct | 105 ms | 592 KB | Output is partially correct |
29 | Partially correct | 89 ms | 592 KB | Output is partially correct |
30 | Partially correct | 105 ms | 644 KB | Output is partially correct |
31 | Correct | 98 ms | 592 KB | Output is correct |
32 | Correct | 97 ms | 644 KB | Output is correct |
33 | Correct | 98 ms | 648 KB | Output is correct |
34 | Correct | 125 ms | 864 KB | Output is correct |
35 | Partially correct | 100 ms | 576 KB | Output is partially correct |
36 | Partially correct | 98 ms | 620 KB | Output is partially correct |
37 | Correct | 85 ms | 708 KB | Output is correct |
38 | Correct | 105 ms | 420 KB | Output is correct |
39 | Partially correct | 120 ms | 592 KB | Output is partially correct |
40 | Partially correct | 101 ms | 432 KB | Output is partially correct |
41 | Partially correct | 107 ms | 692 KB | Output is partially correct |
42 | Partially correct | 104 ms | 592 KB | Output is partially correct |
43 | Correct | 6 ms | 344 KB | Output is correct |
44 | Correct | 36 ms | 536 KB | Output is correct |
45 | Correct | 100 ms | 440 KB | Output is correct |
46 | Correct | 63 ms | 600 KB | Output is correct |
47 | Correct | 125 ms | 484 KB | Output is correct |
48 | Correct | 103 ms | 440 KB | Output is correct |