# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1059988 | 2024-08-15T09:54:04 Z | AmirAli_H1 | Rarest Insects (IOI22_insects) | C++17 | 148 ms | 964 KB |
// In the name of Allah #include <bits/stdc++.h> #include "insects.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define endl '\n' #define sep ' ' #define F first #define S second #define Mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) const int maxn = 2000 + 4; int n, k; set<int> st; int res; vector<int> ls; void addx(int j) { st.insert(j); move_inside(j); } void delx(int j) { st.erase(j); move_outside(j); } int askx() { return press_button(); } void del_all() { while (!st.empty()) { int j = *st.begin(); delx(j); } } bool ok1(ll x) { del_all(); for (int i = 0; i < n; i++) { addx(i); if (askx() > x) delx(i); } return (len(st) == k * x); } int solve1(int R) { int l = 1, r = R + 1; while (r - l > 1) { int mid = (l + r) / 2; if (ok1(mid)) l = mid; else r = mid; } return l; } int solve2(int R) { return 0; } int min_cardinality(int N) { n = N; for (int i = 0; i < n; i++) { addx(i); if (askx() >= 2) delx(i); } for (int j : st) ls.pb(j); k = len(ls); del_all(); if (1) return solve1(n / k); else return solve2(k); }
# | 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 | 344 KB | Output is correct |
6 | Correct | 8 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 7 ms | 432 KB | Output is correct |
9 | Correct | 5 ms | 344 KB | Output is correct |
10 | Correct | 10 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 6 ms | 432 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 6 ms | 436 KB | Output is correct |
15 | Correct | 7 ms | 688 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 5 ms | 344 KB | Output is correct |
19 | Correct | 5 ms | 344 KB | Output is correct |
20 | Correct | 4 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 344 KB | Output is correct |
22 | Correct | 1 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 | 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 | 8 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 7 ms | 432 KB | Output is correct |
9 | Correct | 5 ms | 344 KB | Output is correct |
10 | Correct | 10 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 6 ms | 432 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 6 ms | 436 KB | Output is correct |
15 | Correct | 7 ms | 688 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 5 ms | 344 KB | Output is correct |
19 | Correct | 5 ms | 344 KB | Output is correct |
20 | Correct | 4 ms | 344 KB | Output is correct |
21 | Correct | 3 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 64 ms | 600 KB | Output is correct |
24 | Correct | 3 ms | 344 KB | Output is correct |
25 | Correct | 40 ms | 676 KB | Output is correct |
26 | Correct | 27 ms | 604 KB | Output is correct |
27 | Correct | 49 ms | 688 KB | Output is correct |
28 | Correct | 6 ms | 448 KB | Output is correct |
29 | Correct | 59 ms | 436 KB | Output is correct |
30 | Correct | 32 ms | 412 KB | Output is correct |
31 | Correct | 53 ms | 344 KB | Output is correct |
32 | Correct | 35 ms | 600 KB | Output is correct |
33 | Correct | 36 ms | 436 KB | Output is correct |
34 | Correct | 49 ms | 448 KB | Output is correct |
35 | Correct | 50 ms | 600 KB | Output is correct |
36 | Correct | 43 ms | 684 KB | Output is correct |
37 | Correct | 28 ms | 600 KB | Output is correct |
38 | Correct | 25 ms | 600 KB | Output is correct |
39 | Correct | 9 ms | 344 KB | Output is correct |
40 | Correct | 13 ms | 716 KB | Output is correct |
41 | Correct | 5 ms | 460 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 | 344 KB | Output is correct |
6 | Partially correct | 0 ms | 344 KB | Output is partially correct |
7 | Partially correct | 139 ms | 748 KB | Output is partially correct |
8 | Correct | 12 ms | 344 KB | Output is correct |
9 | Partially correct | 101 ms | 920 KB | Output is partially correct |
10 | Partially correct | 71 ms | 600 KB | Output is partially correct |
11 | Partially correct | 121 ms | 600 KB | Output is partially correct |
12 | Correct | 25 ms | 600 KB | Output is correct |
13 | Partially correct | 148 ms | 664 KB | Output is partially correct |
14 | Partially correct | 75 ms | 848 KB | Output is partially correct |
15 | Partially correct | 112 ms | 748 KB | Output is partially correct |
16 | Partially correct | 95 ms | 504 KB | Output is partially correct |
17 | Partially correct | 104 ms | 964 KB | Output is partially correct |
18 | Partially correct | 109 ms | 460 KB | Output is partially correct |
19 | Partially correct | 116 ms | 864 KB | Output is partially correct |
20 | Partially correct | 93 ms | 656 KB | Output is partially correct |
21 | Partially correct | 79 ms | 704 KB | Output is partially correct |
22 | Partially correct | 62 ms | 688 KB | Output is partially correct |
23 | Partially correct | 46 ms | 440 KB | Output is partially correct |
24 | Correct | 38 ms | 592 KB | Output is correct |
25 | Correct | 14 ms | 856 KB | Output is correct |
26 | Correct | 9 ms | 344 KB | Output is correct |
27 | Partially correct | 72 ms | 668 KB | Output is partially correct |
28 | Partially correct | 74 ms | 956 KB | Output is partially correct |
29 | Partially correct | 109 ms | 508 KB | Output is partially correct |
30 | Partially correct | 100 ms | 500 KB | Output is partially correct |
31 | Partially correct | 59 ms | 688 KB | Output is partially correct |
32 | Partially correct | 68 ms | 688 KB | Output is partially correct |
33 | Partially correct | 57 ms | 460 KB | Output is partially correct |
34 | Partially correct | 61 ms | 600 KB | Output is partially correct |
35 | Partially correct | 71 ms | 860 KB | Output is partially correct |
36 | Partially correct | 75 ms | 720 KB | Output is partially correct |
37 | Partially correct | 62 ms | 444 KB | Output is partially correct |
38 | Partially correct | 68 ms | 712 KB | Output is partially correct |
39 | Partially correct | 52 ms | 720 KB | Output is partially correct |
40 | Partially correct | 61 ms | 888 KB | Output is partially correct |
41 | Partially correct | 95 ms | 748 KB | Output is partially correct |
42 | Partially correct | 82 ms | 696 KB | Output is partially correct |
43 | Partially correct | 17 ms | 432 KB | Output is partially correct |
44 | Partially correct | 96 ms | 344 KB | Output is partially correct |
45 | Partially correct | 138 ms | 728 KB | Output is partially correct |
46 | Correct | 14 ms | 464 KB | Output is correct |
47 | Correct | 26 ms | 648 KB | Output is correct |
48 | Correct | 29 ms | 480 KB | Output is correct |