#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);
}
move_outside(i);
}
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);
}*/
# |
결과 |
실행 시간 |
메모리 |
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 |
92 ms |
344 KB |
Output is correct |
7 |
Correct |
111 ms |
424 KB |
Output is correct |
8 |
Correct |
100 ms |
344 KB |
Output is correct |
9 |
Correct |
100 ms |
344 KB |
Output is correct |
10 |
Correct |
104 ms |
344 KB |
Output is correct |
11 |
Correct |
101 ms |
424 KB |
Output is correct |
12 |
Correct |
95 ms |
344 KB |
Output is correct |
13 |
Correct |
99 ms |
356 KB |
Output is correct |
14 |
Correct |
108 ms |
344 KB |
Output is correct |
15 |
Correct |
105 ms |
344 KB |
Output is correct |
16 |
Correct |
105 ms |
344 KB |
Output is correct |
17 |
Correct |
112 ms |
344 KB |
Output is correct |
18 |
Correct |
99 ms |
344 KB |
Output is correct |
19 |
Correct |
119 ms |
344 KB |
Output is correct |
20 |
Correct |
118 ms |
416 KB |
Output is correct |
21 |
Correct |
102 ms |
420 KB |
Output is correct |
22 |
Correct |
98 ms |
428 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 |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
92 ms |
344 KB |
Output is correct |
7 |
Correct |
111 ms |
424 KB |
Output is correct |
8 |
Correct |
100 ms |
344 KB |
Output is correct |
9 |
Correct |
100 ms |
344 KB |
Output is correct |
10 |
Correct |
104 ms |
344 KB |
Output is correct |
11 |
Correct |
101 ms |
424 KB |
Output is correct |
12 |
Correct |
95 ms |
344 KB |
Output is correct |
13 |
Correct |
99 ms |
356 KB |
Output is correct |
14 |
Correct |
108 ms |
344 KB |
Output is correct |
15 |
Correct |
105 ms |
344 KB |
Output is correct |
16 |
Correct |
105 ms |
344 KB |
Output is correct |
17 |
Correct |
112 ms |
344 KB |
Output is correct |
18 |
Correct |
99 ms |
344 KB |
Output is correct |
19 |
Correct |
119 ms |
344 KB |
Output is correct |
20 |
Correct |
118 ms |
416 KB |
Output is correct |
21 |
Correct |
102 ms |
420 KB |
Output is correct |
22 |
Correct |
98 ms |
428 KB |
Output is correct |
23 |
Incorrect |
235 ms |
344 KB |
Too many queries. |
24 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
344 KB |
Output is partially correct |
6 |
Partially correct |
1 ms |
344 KB |
Output is partially correct |
7 |
Incorrect |
198 ms |
344 KB |
Too many queries. |
8 |
Halted |
0 ms |
0 KB |
- |