#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int min_cardinality(int n) {
vi T(n), C(n, 1);
for(int i = 0; i < n; i++) T[i] = i;
for(int i = 0; i < n-1; i++) {
if(T[i] != i) continue;
move_inside(i);
for(int j = i+1; j < n; j++) {
if(T[i] != i) continue;
move_inside(j);
int t = press_button();
if(t == 2) T[j] = T[i], C[i]++, C[j] = n;
move_outside(j);
}
move_outside(i);
}
int mn = n;
for(auto x : C) mn = min(x, mn);
return mn;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
129 ms |
344 KB |
Output is correct |
8 |
Correct |
12 ms |
344 KB |
Output is correct |
9 |
Correct |
14 ms |
344 KB |
Output is correct |
10 |
Correct |
3 ms |
344 KB |
Output is correct |
11 |
Correct |
67 ms |
344 KB |
Output is correct |
12 |
Correct |
8 ms |
344 KB |
Output is correct |
13 |
Correct |
15 ms |
344 KB |
Output is correct |
14 |
Correct |
5 ms |
596 KB |
Output is correct |
15 |
Correct |
11 ms |
344 KB |
Output is correct |
16 |
Correct |
6 ms |
344 KB |
Output is correct |
17 |
Correct |
18 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
344 KB |
Output is correct |
19 |
Correct |
20 ms |
344 KB |
Output is correct |
20 |
Correct |
49 ms |
344 KB |
Output is correct |
21 |
Correct |
92 ms |
344 KB |
Output is correct |
22 |
Correct |
108 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
129 ms |
344 KB |
Output is correct |
8 |
Correct |
12 ms |
344 KB |
Output is correct |
9 |
Correct |
14 ms |
344 KB |
Output is correct |
10 |
Correct |
3 ms |
344 KB |
Output is correct |
11 |
Correct |
67 ms |
344 KB |
Output is correct |
12 |
Correct |
8 ms |
344 KB |
Output is correct |
13 |
Correct |
15 ms |
344 KB |
Output is correct |
14 |
Correct |
5 ms |
596 KB |
Output is correct |
15 |
Correct |
11 ms |
344 KB |
Output is correct |
16 |
Correct |
6 ms |
344 KB |
Output is correct |
17 |
Correct |
18 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
344 KB |
Output is correct |
19 |
Correct |
20 ms |
344 KB |
Output is correct |
20 |
Correct |
49 ms |
344 KB |
Output is correct |
21 |
Correct |
92 ms |
344 KB |
Output is correct |
22 |
Correct |
108 ms |
344 KB |
Output is correct |
23 |
Correct |
8 ms |
344 KB |
Output is correct |
24 |
Incorrect |
236 ms |
340 KB |
Too many queries. |
25 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
14 ms |
344 KB |
Output is correct |
8 |
Incorrect |
275 ms |
344 KB |
Too many queries. |
9 |
Halted |
0 ms |
0 KB |
- |