# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
926864 | 2024-02-14T01:15:42 Z | beaboss | 드문 곤충 (IOI22_insects) | C++17 | 119 ms | 1688 KB |
// Source: https://oj.uz/problem/view/IOI22_insects // #include "insects.h" #include "bits/stdc++.h" using namespace std; #define s second #define f first #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<pii> vpii; typedef vector<int> vi; #define FOR(i, a, b) for (int i = (a); i<b; i++) bool ckmin(int& a, int b){ return b < a ? a = b, true : false; } bool ckmax(int& a, int b){ return b > a ? a = b, true : false; } set<int> in, out; void gout(int i) { in.erase(i); out.insert(i); move_outside(i); } void gin(int i) { out.erase(i); in.insert(i); move_inside(i); } int min_cardinality(int n) { // cout << n << endl; FOR(i, 0, n) out.insert(i); int d = n; FOR(i, 0, n) { gin(i); if (press_button() > 1) { gout(i); d--; } } set<int> oth = in; for (auto val: oth) { gout(val); } if (d == 1) { return n; } int alr = 0; // cout << 'd' << endl; int prv = -1; int lo = 1; int hi = n / 2; // int alr = 0; while (lo < hi) { int t = (lo + hi + 1) / (2); // cout << out.size() << t << endl; // for (auto val: out) { // cout << val << ' '; // } // cout << endl; // testing t // cout << lo << hi << t << endl; set<int> oth = out; for (auto val: oth) { gin(val); if (press_button() > t) { gout(val); } } // cout << in.size() << endl; if (in.size() + alr == t * d) { // all here --- erase this section // alr += t; // for (auto it = in.begin(); it != in.end();) { // move_outside(*it); // it++; // in.erase(prev(it, 1)); // } // set<int> oth = in; // for (auto val: oth) gout(val); alr += in.size(); in.clear(); lo = t; } else { // erase everything not in this section out.clear(); set<int> oth = in; for (auto val: oth) gout(val); hi = t-1; } } // cout << alr << endl; return lo; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 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 | 1 ms | 344 KB | Output is correct |
7 | Correct | 7 ms | 464 KB | Output is correct |
8 | Correct | 4 ms | 600 KB | Output is correct |
9 | Correct | 6 ms | 700 KB | Output is correct |
10 | Correct | 2 ms | 440 KB | Output is correct |
11 | Correct | 4 ms | 600 KB | Output is correct |
12 | Correct | 4 ms | 600 KB | Output is correct |
13 | Correct | 5 ms | 600 KB | Output is correct |
14 | Correct | 4 ms | 856 KB | Output is correct |
15 | Correct | 4 ms | 344 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 6 ms | 600 KB | Output is correct |
18 | Correct | 6 ms | 700 KB | Output is correct |
19 | Correct | 6 ms | 600 KB | Output is correct |
20 | Correct | 6 ms | 600 KB | Output is correct |
21 | Correct | 6 ms | 600 KB | Output is correct |
22 | Correct | 6 ms | 600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 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 | 1 ms | 344 KB | Output is correct |
7 | Correct | 7 ms | 464 KB | Output is correct |
8 | Correct | 4 ms | 600 KB | Output is correct |
9 | Correct | 6 ms | 700 KB | Output is correct |
10 | Correct | 2 ms | 440 KB | Output is correct |
11 | Correct | 4 ms | 600 KB | Output is correct |
12 | Correct | 4 ms | 600 KB | Output is correct |
13 | Correct | 5 ms | 600 KB | Output is correct |
14 | Correct | 4 ms | 856 KB | Output is correct |
15 | Correct | 4 ms | 344 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 6 ms | 600 KB | Output is correct |
18 | Correct | 6 ms | 700 KB | Output is correct |
19 | Correct | 6 ms | 600 KB | Output is correct |
20 | Correct | 6 ms | 600 KB | Output is correct |
21 | Correct | 6 ms | 600 KB | Output is correct |
22 | Correct | 6 ms | 600 KB | Output is correct |
23 | Correct | 5 ms | 344 KB | Output is correct |
24 | Correct | 50 ms | 1296 KB | Output is correct |
25 | Correct | 24 ms | 892 KB | Output is correct |
26 | Correct | 28 ms | 1396 KB | Output is correct |
27 | Correct | 14 ms | 596 KB | Output is correct |
28 | Correct | 31 ms | 808 KB | Output is correct |
29 | Correct | 23 ms | 600 KB | Output is correct |
30 | Correct | 34 ms | 1100 KB | Output is correct |
31 | Correct | 19 ms | 848 KB | Output is correct |
32 | Correct | 24 ms | 768 KB | Output is correct |
33 | Correct | 22 ms | 636 KB | Output is correct |
34 | Correct | 26 ms | 756 KB | Output is correct |
35 | Correct | 31 ms | 968 KB | Output is correct |
36 | Correct | 30 ms | 684 KB | Output is correct |
37 | Correct | 33 ms | 1088 KB | Output is correct |
38 | Correct | 38 ms | 1288 KB | Output is correct |
39 | Correct | 42 ms | 1064 KB | Output is correct |
40 | Correct | 43 ms | 1076 KB | Output is correct |
41 | Correct | 48 ms | 832 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 | 0 ms | 344 KB | Output is correct |
7 | Correct | 9 ms | 344 KB | Output is correct |
8 | Partially correct | 105 ms | 1108 KB | Output is partially correct |
9 | Partially correct | 76 ms | 936 KB | Output is partially correct |
10 | Partially correct | 83 ms | 1088 KB | Output is partially correct |
11 | Correct | 22 ms | 592 KB | Output is correct |
12 | Partially correct | 63 ms | 1688 KB | Output is partially correct |
13 | Partially correct | 47 ms | 616 KB | Output is partially correct |
14 | Partially correct | 69 ms | 820 KB | Output is partially correct |
15 | Partially correct | 34 ms | 852 KB | Output is partially correct |
16 | Partially correct | 48 ms | 688 KB | Output is partially correct |
17 | Partially correct | 57 ms | 708 KB | Output is partially correct |
18 | Partially correct | 54 ms | 748 KB | Output is partially correct |
19 | Partially correct | 63 ms | 840 KB | Output is partially correct |
20 | Partially correct | 58 ms | 848 KB | Output is partially correct |
21 | Partially correct | 71 ms | 696 KB | Output is partially correct |
22 | Partially correct | 83 ms | 1316 KB | Output is partially correct |
23 | Partially correct | 108 ms | 700 KB | Output is partially correct |
24 | Partially correct | 119 ms | 956 KB | Output is partially correct |
25 | Partially correct | 100 ms | 968 KB | Output is partially correct |
26 | Partially correct | 103 ms | 1124 KB | Output is partially correct |
27 | Partially correct | 59 ms | 824 KB | Output is partially correct |
28 | Partially correct | 77 ms | 1080 KB | Output is partially correct |
29 | Partially correct | 56 ms | 852 KB | Output is partially correct |
30 | Partially correct | 57 ms | 596 KB | Output is partially correct |
31 | Partially correct | 79 ms | 860 KB | Output is partially correct |
32 | Partially correct | 68 ms | 1224 KB | Output is partially correct |
33 | Partially correct | 90 ms | 1216 KB | Output is partially correct |
34 | Partially correct | 75 ms | 1012 KB | Output is partially correct |
35 | Partially correct | 56 ms | 988 KB | Output is partially correct |
36 | Partially correct | 73 ms | 780 KB | Output is partially correct |
37 | Partially correct | 73 ms | 860 KB | Output is partially correct |
38 | Partially correct | 78 ms | 692 KB | Output is partially correct |
39 | Partially correct | 74 ms | 936 KB | Output is partially correct |
40 | Partially correct | 74 ms | 940 KB | Output is partially correct |
41 | Partially correct | 58 ms | 1080 KB | Output is partially correct |
42 | Partially correct | 64 ms | 936 KB | Output is partially correct |
43 | Partially correct | 8 ms | 600 KB | Output is partially correct |
44 | Partially correct | 24 ms | 1008 KB | Output is partially correct |
45 | Correct | 26 ms | 600 KB | Output is correct |
46 | Partially correct | 66 ms | 1116 KB | Output is partially correct |
47 | Partially correct | 63 ms | 1184 KB | Output is partially correct |
48 | Partially correct | 68 ms | 1376 KB | Output is partially correct |