#include<bits/stdc++.h>
#include "insects.h"
#define f first
#define s second
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
using namespace std;
int pr[401]{0};
int sz[401]{0};
int get(int r){
return pr[r]==r?r:pr[r]=get(pr[r]);
}
int min_cardinality(int N)
{
iota(pr,pr+N+1,0);
for(int i=0;i<N+1;i++)sz[i]=1;
for(int i=0;i<N;i++){
for(int j=i+1;j<N;j++){
move_inside(i);
move_inside(j);
int u=get(i);
int v=get(j);
if(press_button()==2&&u!=v){
sz[u]+=sz[v];
pr[v]=get(u);
}move_outside(i);
move_outside(j);
}
}int ans=1e9;
for(int i=0;i<N;i++)ans=min(ans,sz[get(i)]);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
596 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
93 ms |
344 KB |
Output is correct |
7 |
Correct |
90 ms |
344 KB |
Output is correct |
8 |
Correct |
95 ms |
344 KB |
Output is correct |
9 |
Correct |
95 ms |
344 KB |
Output is correct |
10 |
Correct |
86 ms |
344 KB |
Output is correct |
11 |
Correct |
86 ms |
344 KB |
Output is correct |
12 |
Correct |
93 ms |
344 KB |
Output is correct |
13 |
Correct |
96 ms |
344 KB |
Output is correct |
14 |
Correct |
99 ms |
596 KB |
Output is correct |
15 |
Correct |
85 ms |
344 KB |
Output is correct |
16 |
Correct |
85 ms |
344 KB |
Output is correct |
17 |
Correct |
103 ms |
344 KB |
Output is correct |
18 |
Correct |
87 ms |
344 KB |
Output is correct |
19 |
Correct |
98 ms |
344 KB |
Output is correct |
20 |
Correct |
82 ms |
344 KB |
Output is correct |
21 |
Correct |
90 ms |
344 KB |
Output is correct |
22 |
Correct |
82 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 |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
596 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
93 ms |
344 KB |
Output is correct |
7 |
Correct |
90 ms |
344 KB |
Output is correct |
8 |
Correct |
95 ms |
344 KB |
Output is correct |
9 |
Correct |
95 ms |
344 KB |
Output is correct |
10 |
Correct |
86 ms |
344 KB |
Output is correct |
11 |
Correct |
86 ms |
344 KB |
Output is correct |
12 |
Correct |
93 ms |
344 KB |
Output is correct |
13 |
Correct |
96 ms |
344 KB |
Output is correct |
14 |
Correct |
99 ms |
596 KB |
Output is correct |
15 |
Correct |
85 ms |
344 KB |
Output is correct |
16 |
Correct |
85 ms |
344 KB |
Output is correct |
17 |
Correct |
103 ms |
344 KB |
Output is correct |
18 |
Correct |
87 ms |
344 KB |
Output is correct |
19 |
Correct |
98 ms |
344 KB |
Output is correct |
20 |
Correct |
82 ms |
344 KB |
Output is correct |
21 |
Correct |
90 ms |
344 KB |
Output is correct |
22 |
Correct |
82 ms |
344 KB |
Output is correct |
23 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
24 |
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 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
6 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
7 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |