#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
int min_cardinality(int N) {
vector<int> group(N);
iota(all(group),0);
for (int a=0;a<N;a++){
if (group[a]==a){
move_inside(a);
for (int b=a+1;b<N;b++){
if (group[b]==b){
move_inside(b);
int card = press_button();
if (card==2){
group[b]=group[a];
}
move_outside(b);
}
}
move_outside(a);
}
}
vector<int> group_f(N,0);
for (int e:group){
group_f[e]++;
}
int ans=N;
for (int f:group_f){
if (f>0){
ans=min(ans,f);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 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 |
118 ms |
344 KB |
Output is correct |
8 |
Correct |
8 ms |
344 KB |
Output is correct |
9 |
Correct |
13 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
32 ms |
344 KB |
Output is correct |
12 |
Correct |
3 ms |
344 KB |
Output is correct |
13 |
Correct |
7 ms |
344 KB |
Output is correct |
14 |
Correct |
3 ms |
344 KB |
Output is correct |
15 |
Correct |
4 ms |
344 KB |
Output is correct |
16 |
Correct |
6 ms |
344 KB |
Output is correct |
17 |
Correct |
8 ms |
344 KB |
Output is correct |
18 |
Correct |
13 ms |
344 KB |
Output is correct |
19 |
Correct |
5 ms |
344 KB |
Output is correct |
20 |
Correct |
30 ms |
344 KB |
Output is correct |
21 |
Correct |
35 ms |
344 KB |
Output is correct |
22 |
Correct |
70 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 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 |
118 ms |
344 KB |
Output is correct |
8 |
Correct |
8 ms |
344 KB |
Output is correct |
9 |
Correct |
13 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
32 ms |
344 KB |
Output is correct |
12 |
Correct |
3 ms |
344 KB |
Output is correct |
13 |
Correct |
7 ms |
344 KB |
Output is correct |
14 |
Correct |
3 ms |
344 KB |
Output is correct |
15 |
Correct |
4 ms |
344 KB |
Output is correct |
16 |
Correct |
6 ms |
344 KB |
Output is correct |
17 |
Correct |
8 ms |
344 KB |
Output is correct |
18 |
Correct |
13 ms |
344 KB |
Output is correct |
19 |
Correct |
5 ms |
344 KB |
Output is correct |
20 |
Correct |
30 ms |
344 KB |
Output is correct |
21 |
Correct |
35 ms |
344 KB |
Output is correct |
22 |
Correct |
70 ms |
344 KB |
Output is correct |
23 |
Correct |
4 ms |
436 KB |
Output is correct |
24 |
Incorrect |
278 ms |
344 KB |
Too many queries. |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
12 ms |
416 KB |
Output is correct |
8 |
Incorrect |
268 ms |
344 KB |
Too many queries. |
9 |
Halted |
0 ms |
0 KB |
- |