#include<bits/stdc++.h>
#include "insects.h"
using namespace std;
int n;
const int mx=2e7+10;
long long dp[mx];
int min_cardinality(int N){
int arr[N+1];
for(int i=0;i<N;i++){
arr[i]=-1;
}
map<int,int>mp;
for(int i=0;i<N;i++){
move_inside(i);
if(arr[i]==-1){
arr[i]=i;
}
for(int j=i+1;j<N;j++){
move_inside(j);
int z= press_button();
if(z==2){
arr[j]=arr[i];
}
move_outside(j);
}
}
for(int i=0;i<N;i++){
mp[arr[i]]++;
}
int ans=N;
for(int i=0;i<N;i++){
ans=min(ans,mp[arr[i]]);
}
return ans;
}
/*
int main(){
cout<<min_cardinality(9);
}*/
# |
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 |
Incorrect |
1 ms |
344 KB |
Wrong answer. |
5 |
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 |
Incorrect |
1 ms |
344 KB |
Wrong answer. |
5 |
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 |
596 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Incorrect |
0 ms |
344 KB |
Wrong answer. |
6 |
Halted |
0 ms |
0 KB |
- |