#include "insects.h"
#ifdef NYAOWO
#include "stub.cpp"
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;
int min_cardinality(int n) {
vector<int> alive;
For(i, 0, n - 1) alive.eb(i);
mt19937_64 rng(48763);
shuffle(all(alive), rng);
int mn = n * 8;
while(sz(alive)) {
int rep = alive.back();
alive.pop_back();
move_inside(rep);
vector<int> v0, v1(1, rep);
for(auto &i:alive) {
move_inside(i);
if(press_button() == 2) v1.eb(i);
else v0.eb(i);
move_outside(i);
}
move_outside(rep);
mn = min(mn, sz(v1));
alive.swap(v0);
}
return mn;
}
/*
6
5 8 9 5 9 9
1
7
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
2 ms |
208 KB |
Output is correct |
7 |
Correct |
88 ms |
208 KB |
Output is correct |
8 |
Correct |
7 ms |
248 KB |
Output is correct |
9 |
Correct |
11 ms |
208 KB |
Output is correct |
10 |
Correct |
2 ms |
208 KB |
Output is correct |
11 |
Correct |
41 ms |
208 KB |
Output is correct |
12 |
Correct |
4 ms |
208 KB |
Output is correct |
13 |
Correct |
12 ms |
208 KB |
Output is correct |
14 |
Correct |
6 ms |
208 KB |
Output is correct |
15 |
Correct |
5 ms |
208 KB |
Output is correct |
16 |
Correct |
8 ms |
208 KB |
Output is correct |
17 |
Correct |
12 ms |
208 KB |
Output is correct |
18 |
Correct |
18 ms |
208 KB |
Output is correct |
19 |
Correct |
13 ms |
208 KB |
Output is correct |
20 |
Correct |
37 ms |
208 KB |
Output is correct |
21 |
Correct |
33 ms |
208 KB |
Output is correct |
22 |
Correct |
108 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
2 ms |
208 KB |
Output is correct |
7 |
Correct |
88 ms |
208 KB |
Output is correct |
8 |
Correct |
7 ms |
248 KB |
Output is correct |
9 |
Correct |
11 ms |
208 KB |
Output is correct |
10 |
Correct |
2 ms |
208 KB |
Output is correct |
11 |
Correct |
41 ms |
208 KB |
Output is correct |
12 |
Correct |
4 ms |
208 KB |
Output is correct |
13 |
Correct |
12 ms |
208 KB |
Output is correct |
14 |
Correct |
6 ms |
208 KB |
Output is correct |
15 |
Correct |
5 ms |
208 KB |
Output is correct |
16 |
Correct |
8 ms |
208 KB |
Output is correct |
17 |
Correct |
12 ms |
208 KB |
Output is correct |
18 |
Correct |
18 ms |
208 KB |
Output is correct |
19 |
Correct |
13 ms |
208 KB |
Output is correct |
20 |
Correct |
37 ms |
208 KB |
Output is correct |
21 |
Correct |
33 ms |
208 KB |
Output is correct |
22 |
Correct |
108 ms |
256 KB |
Output is correct |
23 |
Correct |
7 ms |
304 KB |
Output is correct |
24 |
Incorrect |
242 ms |
236 KB |
Too many queries. |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
224 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
13 ms |
312 KB |
Output is correct |
8 |
Incorrect |
218 ms |
208 KB |
Too many queries. |
9 |
Halted |
0 ms |
0 KB |
- |