#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);
if(press_button()==2&&get(i)!=get(j)){
pr[get(i)]=get(j);
sz[get(j)]+=sz[get(i)];
}move_outside(i);
move_outside(j);
}
}int ans=1e9;
for(int i=0;i<N;i++)ans=min(ans,sz[get(i)]);
return ans;
}
# |
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 |
340 KB |
Output is correct |
6 |
Incorrect |
122 ms |
344 KB |
Wrong answer. |
7 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
340 KB |
Output is correct |
6 |
Incorrect |
122 ms |
344 KB |
Wrong answer. |
7 |
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 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
6 |
Incorrect |
1 ms |
344 KB |
Wrong answer. |
7 |
Halted |
0 ms |
0 KB |
- |