# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1025192 | 2024-07-16T17:16:25 Z | Wansur | Rarest Insects (IOI22_insects) | C++17 | 46 ms | 848 KB |
#include <bits/stdc++.h> #define ent '\n' void move_inside(int i); void move_outside(int i); int press_button(); using namespace std; typedef long long ll; const int maxn = 1e5 + 12; bool used[maxn]; vector<int> d; int n, m, c, cnt = 0; bool check(int x){ x -= cnt; vector<int> a, b; for(int i=0;i<n;i++){ if(used[i]) continue; move_inside(i); if(press_button() > x){ move_outside(i); b.push_back(i); } else a.push_back(i); if(a.size() == x * m) break; } for(int x:a){ move_outside(x); } if(a.size() == x * m){ cnt += x; for(int x:a){ used[x] = 1; c--; } return 1; } for(int x:b){ used[x] = 1; c--; } return 0; } int min_cardinality(int N){ n = N; c = n; for(int i=0;i<n;i++){ move_inside(i); if(press_button() != 1){ move_outside(i); } else d.push_back(i); } for(int i:d){ move_outside(i); } m = d.size(); int ans = 0; for(int l = 1, r = (n + m - 1) / m; l <= r;){ int mid = l + r >> 1; if(check(mid)){ ans = mid; l = mid + 1; } else r = mid - 1; } return ans; }
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 | 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 | 2 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 444 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 2 ms | 344 KB | Output is correct |
15 | Correct | 2 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 444 KB | Output is correct |
18 | Correct | 3 ms | 344 KB | Output is correct |
19 | Correct | 2 ms | 344 KB | Output is correct |
20 | Correct | 4 ms | 344 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 2 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 | 2 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 3 ms | 444 KB | Output is correct |
13 | Correct | 3 ms | 344 KB | Output is correct |
14 | Correct | 2 ms | 344 KB | Output is correct |
15 | Correct | 2 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 444 KB | Output is correct |
18 | Correct | 3 ms | 344 KB | Output is correct |
19 | Correct | 2 ms | 344 KB | Output is correct |
20 | Correct | 4 ms | 344 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 2 ms | 344 KB | Output is correct |
23 | Correct | 9 ms | 344 KB | Output is correct |
24 | Correct | 7 ms | 344 KB | Output is correct |
25 | Correct | 11 ms | 444 KB | Output is correct |
26 | Correct | 11 ms | 344 KB | Output is correct |
27 | Correct | 15 ms | 344 KB | Output is correct |
28 | Correct | 15 ms | 600 KB | Output is correct |
29 | Correct | 17 ms | 600 KB | Output is correct |
30 | Correct | 24 ms | 344 KB | Output is correct |
31 | Correct | 8 ms | 344 KB | Output is correct |
32 | Correct | 10 ms | 344 KB | Output is correct |
33 | Correct | 14 ms | 600 KB | Output is correct |
34 | Correct | 10 ms | 344 KB | Output is correct |
35 | Correct | 11 ms | 344 KB | Output is correct |
36 | Correct | 16 ms | 600 KB | Output is correct |
37 | Correct | 13 ms | 448 KB | Output is correct |
38 | Correct | 18 ms | 344 KB | Output is correct |
39 | Correct | 12 ms | 344 KB | Output is correct |
40 | Correct | 14 ms | 436 KB | Output is correct |
41 | Correct | 11 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 1 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 | 19 ms | 444 KB | Output is correct |
8 | Correct | 23 ms | 708 KB | Output is correct |
9 | Correct | 22 ms | 344 KB | Output is correct |
10 | Correct | 42 ms | 428 KB | Output is correct |
11 | Correct | 38 ms | 688 KB | Output is correct |
12 | Correct | 36 ms | 452 KB | Output is correct |
13 | Correct | 31 ms | 344 KB | Output is correct |
14 | Correct | 31 ms | 344 KB | Output is correct |
15 | Correct | 21 ms | 444 KB | Output is correct |
16 | Correct | 25 ms | 428 KB | Output is correct |
17 | Correct | 28 ms | 344 KB | Output is correct |
18 | Correct | 30 ms | 592 KB | Output is correct |
19 | Correct | 21 ms | 340 KB | Output is correct |
20 | Correct | 23 ms | 592 KB | Output is correct |
21 | Correct | 33 ms | 676 KB | Output is correct |
22 | Correct | 29 ms | 596 KB | Output is correct |
23 | Correct | 18 ms | 448 KB | Output is correct |
24 | Partially correct | 35 ms | 424 KB | Output is partially correct |
25 | Correct | 30 ms | 848 KB | Output is correct |
26 | Correct | 34 ms | 700 KB | Output is correct |
27 | Correct | 25 ms | 444 KB | Output is correct |
28 | Correct | 18 ms | 596 KB | Output is correct |
29 | Correct | 46 ms | 344 KB | Output is correct |
30 | Correct | 33 ms | 344 KB | Output is correct |
31 | Correct | 37 ms | 596 KB | Output is correct |
32 | Correct | 37 ms | 688 KB | Output is correct |
33 | Correct | 42 ms | 420 KB | Output is correct |
34 | Correct | 38 ms | 676 KB | Output is correct |
35 | Correct | 34 ms | 676 KB | Output is correct |
36 | Correct | 23 ms | 344 KB | Output is correct |
37 | Correct | 25 ms | 344 KB | Output is correct |
38 | Correct | 32 ms | 604 KB | Output is correct |
39 | Correct | 31 ms | 436 KB | Output is correct |
40 | Correct | 26 ms | 600 KB | Output is correct |
41 | Correct | 23 ms | 344 KB | Output is correct |
42 | Correct | 25 ms | 344 KB | Output is correct |
43 | Correct | 7 ms | 344 KB | Output is correct |
44 | Correct | 21 ms | 600 KB | Output is correct |
45 | Correct | 24 ms | 428 KB | Output is correct |
46 | Correct | 29 ms | 440 KB | Output is correct |
47 | Correct | 19 ms | 448 KB | Output is correct |
48 | Correct | 23 ms | 436 KB | Output is correct |