#include "insects.h"
#include<bits/stdc++.h>
using namespace std;
int min_cardinality(int n){
vector<int> v;
vector<int> s(n, 1);
for (int i=0; i<n; i++) v.push_back(i);
for (int i=0; i<n-1; i++){
if (v[i] < i) continue;
for (int j=0; j<n; j++){
if (v[j] >= i) move_inside(j);
}
int x = press_button();
for (int j=0; j<n; j++){
if (v[j] >= i) move_outside(j);
}
if (x == 1) break;
int y = 1;
move_inside(i);
for (int j=i+1; j<n; j++){
if (v[j] < j) continue;
move_inside(j);
if (press_button() == 2){
s[v[j]]--;
s[v[i]]++;
v[j] = v[i];
y++;
if (y == x) break;
}
move_outside(j);
}
move_outside(i);
}
int bsf = n;
for (int i=0; i<n; i++){
if (s[i] != 0) bsf = min(bsf, s[i]);
}
return bsf;
}
# |
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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
6 ms |
344 KB |
Output is correct |
9 |
Correct |
6 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
3 ms |
344 KB |
Output is correct |
12 |
Correct |
2 ms |
344 KB |
Output is correct |
13 |
Correct |
7 ms |
344 KB |
Output is correct |
14 |
Correct |
3 ms |
596 KB |
Output is correct |
15 |
Correct |
4 ms |
344 KB |
Output is correct |
16 |
Correct |
4 ms |
344 KB |
Output is correct |
17 |
Correct |
5 ms |
344 KB |
Output is correct |
18 |
Correct |
6 ms |
344 KB |
Output is correct |
19 |
Correct |
8 ms |
344 KB |
Output is correct |
20 |
Correct |
20 ms |
340 KB |
Output is correct |
21 |
Correct |
34 ms |
344 KB |
Output is correct |
22 |
Correct |
51 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
6 ms |
344 KB |
Output is correct |
9 |
Correct |
6 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
3 ms |
344 KB |
Output is correct |
12 |
Correct |
2 ms |
344 KB |
Output is correct |
13 |
Correct |
7 ms |
344 KB |
Output is correct |
14 |
Correct |
3 ms |
596 KB |
Output is correct |
15 |
Correct |
4 ms |
344 KB |
Output is correct |
16 |
Correct |
4 ms |
344 KB |
Output is correct |
17 |
Correct |
5 ms |
344 KB |
Output is correct |
18 |
Correct |
6 ms |
344 KB |
Output is correct |
19 |
Correct |
8 ms |
344 KB |
Output is correct |
20 |
Correct |
20 ms |
340 KB |
Output is correct |
21 |
Correct |
34 ms |
344 KB |
Output is correct |
22 |
Correct |
51 ms |
344 KB |
Output is correct |
23 |
Correct |
5 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
81 ms |
1164 KB |
Output is correct |
26 |
Correct |
74 ms |
1408 KB |
Output is correct |
27 |
Correct |
4 ms |
344 KB |
Output is correct |
28 |
Correct |
5 ms |
344 KB |
Output is correct |
29 |
Correct |
10 ms |
592 KB |
Output is correct |
30 |
Correct |
72 ms |
676 KB |
Output is correct |
31 |
Correct |
16 ms |
852 KB |
Output is correct |
32 |
Correct |
21 ms |
592 KB |
Output is correct |
33 |
Correct |
26 ms |
676 KB |
Output is correct |
34 |
Correct |
35 ms |
592 KB |
Output is correct |
35 |
Correct |
37 ms |
832 KB |
Output is correct |
36 |
Correct |
52 ms |
668 KB |
Output is correct |
37 |
Incorrect |
86 ms |
1416 KB |
Too many queries. |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
11 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Incorrect |
94 ms |
924 KB |
Too many queries. |
10 |
Halted |
0 ms |
0 KB |
- |