# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926860 | 2024-02-14T01:04:27 Z | beaboss | Rarest Insects (IOI22_insects) | C++17 | 128 ms | 1716 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--; } } // cout << 'd' << endl; // d = press_button(); // distinct numbers // cout << d << endl; set<int> oth = in; for (auto val: oth) { // cout << val << endl; gout(val); // cout << val << endl; } int alr = 0; // cout << 'd' << endl; int prv = -1; int lo = 1; int hi = n; while (lo < hi) { int t = (lo + hi + 1) / (2); prv = out.size(); // cout << out.size() << t << endl; // for (auto val: out) { // cout << val << ' '; // } // cout << endl; // testing t set<int> oth = out; for (auto val: oth) { gin(val); if (press_button() > t) { gout(val); } } // cout << press_button() << endl; if (in.size() == 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); lo = t; } else { // erase everything not in this section for (auto it = out.begin(); it != out.end();) { it++; out.erase(prev(it, 1)); } set<int> oth = in; for (auto val: oth) gout(val); hi = t-1; } } // cout << alr << endl; return lo; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 356 KB | Output is correct |
4 | Correct | 0 ms | 356 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 7 ms | 600 KB | Output is correct |
7 | Correct | 9 ms | 696 KB | Output is correct |
8 | Correct | 9 ms | 600 KB | Output is correct |
9 | Correct | 6 ms | 344 KB | Output is correct |
10 | Correct | 3 ms | 600 KB | Output is correct |
11 | Correct | 6 ms | 456 KB | Output is correct |
12 | Correct | 6 ms | 600 KB | Output is correct |
13 | Correct | 6 ms | 600 KB | Output is correct |
14 | Correct | 8 ms | 856 KB | Output is correct |
15 | Correct | 8 ms | 600 KB | Output is correct |
16 | Correct | 7 ms | 856 KB | Output is correct |
17 | Correct | 8 ms | 600 KB | Output is correct |
18 | Correct | 6 ms | 600 KB | Output is correct |
19 | Correct | 7 ms | 344 KB | Output is correct |
20 | Correct | 7 ms | 600 KB | Output is correct |
21 | Correct | 7 ms | 600 KB | Output is correct |
22 | Correct | 7 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 356 KB | Output is correct |
4 | Correct | 0 ms | 356 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 7 ms | 600 KB | Output is correct |
7 | Correct | 9 ms | 696 KB | Output is correct |
8 | Correct | 9 ms | 600 KB | Output is correct |
9 | Correct | 6 ms | 344 KB | Output is correct |
10 | Correct | 3 ms | 600 KB | Output is correct |
11 | Correct | 6 ms | 456 KB | Output is correct |
12 | Correct | 6 ms | 600 KB | Output is correct |
13 | Correct | 6 ms | 600 KB | Output is correct |
14 | Correct | 8 ms | 856 KB | Output is correct |
15 | Correct | 8 ms | 600 KB | Output is correct |
16 | Correct | 7 ms | 856 KB | Output is correct |
17 | Correct | 8 ms | 600 KB | Output is correct |
18 | Correct | 6 ms | 600 KB | Output is correct |
19 | Correct | 7 ms | 344 KB | Output is correct |
20 | Correct | 7 ms | 600 KB | Output is correct |
21 | Correct | 7 ms | 600 KB | Output is correct |
22 | Correct | 7 ms | 344 KB | Output is correct |
23 | Correct | 58 ms | 1284 KB | Output is correct |
24 | Correct | 51 ms | 876 KB | Output is correct |
25 | Correct | 50 ms | 816 KB | Output is correct |
26 | Correct | 44 ms | 1012 KB | Output is correct |
27 | Correct | 16 ms | 600 KB | Output is correct |
28 | Correct | 33 ms | 1288 KB | Output is correct |
29 | Correct | 22 ms | 752 KB | Output is correct |
30 | Correct | 43 ms | 1260 KB | Output is correct |
31 | Correct | 50 ms | 1312 KB | Output is correct |
32 | Correct | 51 ms | 804 KB | Output is correct |
33 | Correct | 50 ms | 808 KB | Output is correct |
34 | Correct | 48 ms | 1280 KB | Output is correct |
35 | Correct | 47 ms | 1260 KB | Output is correct |
36 | Correct | 45 ms | 1716 KB | Output is correct |
37 | Correct | 50 ms | 808 KB | Output is correct |
38 | Correct | 50 ms | 1312 KB | Output is correct |
39 | Correct | 47 ms | 1192 KB | Output is correct |
40 | Correct | 47 ms | 824 KB | Output is correct |
41 | Correct | 49 ms | 832 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 424 KB | Output is correct |
6 | Partially correct | 1 ms | 344 KB | Output is partially correct |
7 | Partially correct | 112 ms | 1172 KB | Output is partially correct |
8 | Partially correct | 118 ms | 1028 KB | Output is partially correct |
9 | Partially correct | 116 ms | 944 KB | Output is partially correct |
10 | Partially correct | 103 ms | 1420 KB | Output is partially correct |
11 | Partially correct | 27 ms | 688 KB | Output is partially correct |
12 | Partially correct | 81 ms | 1232 KB | Output is partially correct |
13 | Partially correct | 52 ms | 688 KB | Output is partially correct |
14 | Partially correct | 84 ms | 844 KB | Output is partially correct |
15 | Partially correct | 110 ms | 1424 KB | Output is partially correct |
16 | Partially correct | 123 ms | 940 KB | Output is partially correct |
17 | Partially correct | 122 ms | 1180 KB | Output is partially correct |
18 | Partially correct | 122 ms | 1020 KB | Output is partially correct |
19 | Partially correct | 111 ms | 1028 KB | Output is partially correct |
20 | Partially correct | 109 ms | 1188 KB | Output is partially correct |
21 | Partially correct | 106 ms | 1332 KB | Output is partially correct |
22 | Partially correct | 108 ms | 1184 KB | Output is partially correct |
23 | Partially correct | 104 ms | 940 KB | Output is partially correct |
24 | Partially correct | 102 ms | 960 KB | Output is partially correct |
25 | Partially correct | 110 ms | 1212 KB | Output is partially correct |
26 | Partially correct | 105 ms | 1320 KB | Output is partially correct |
27 | Partially correct | 113 ms | 1092 KB | Output is partially correct |
28 | Partially correct | 120 ms | 848 KB | Output is partially correct |
29 | Partially correct | 114 ms | 1652 KB | Output is partially correct |
30 | Partially correct | 125 ms | 1416 KB | Output is partially correct |
31 | Partially correct | 108 ms | 948 KB | Output is partially correct |
32 | Partially correct | 106 ms | 1672 KB | Output is partially correct |
33 | Partially correct | 103 ms | 860 KB | Output is partially correct |
34 | Partially correct | 101 ms | 1324 KB | Output is partially correct |
35 | Partially correct | 120 ms | 1168 KB | Output is partially correct |
36 | Partially correct | 121 ms | 928 KB | Output is partially correct |
37 | Partially correct | 95 ms | 1328 KB | Output is partially correct |
38 | Partially correct | 115 ms | 1080 KB | Output is partially correct |
39 | Partially correct | 126 ms | 1328 KB | Output is partially correct |
40 | Partially correct | 124 ms | 940 KB | Output is partially correct |
41 | Partially correct | 128 ms | 1184 KB | Output is partially correct |
42 | Partially correct | 127 ms | 1164 KB | Output is partially correct |
43 | Partially correct | 10 ms | 488 KB | Output is partially correct |
44 | Partially correct | 33 ms | 680 KB | Output is partially correct |
45 | Partially correct | 114 ms | 1172 KB | Output is partially correct |
46 | Partially correct | 73 ms | 1232 KB | Output is partially correct |
47 | Partially correct | 73 ms | 1000 KB | Output is partially correct |
48 | Partially correct | 79 ms | 1224 KB | Output is partially correct |