#include "insects.h"
#include <variant>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll int
#define F first
#define S second
#define pb push_back
#define sz(x) (ll)x.size()
#define endl "\n"
typedef vector <ll> vi;
typedef pair <ll, ll> ii;
typedef vector <ii> vii;
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
void printVct(vi &v){
for (ll i =0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
int min_cardinality(int N){
ll n = N;
vi v(n);
for (ll i =0; i<n; i++){
v[i] = i;
}
for (ll i =0; i<n; i++){
move_inside(i);
for (ll j =i+1; j<n; j++){
move_inside(j);
ll x = press_button();
if (x == 2){
v[j] = v[i];
}
move_outside(j);
}
move_outside(i);
}
// printVct(v);
sort(v.begin(), v.end());
vi f(n,0);
for (ll i =0; i<n; i++){
f[v[i]]++;
}
ll ans = 10000000;
for (ll i =0; i<n; i++){
if (f[i]){
ans = min(ans, f[i]);
}
}
return ans;
}
/*
6
5 8 9 5 9 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 |
596 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
99 ms |
344 KB |
Output is correct |
7 |
Correct |
94 ms |
344 KB |
Output is correct |
8 |
Correct |
115 ms |
344 KB |
Output is correct |
9 |
Correct |
114 ms |
500 KB |
Output is correct |
10 |
Correct |
94 ms |
344 KB |
Output is correct |
11 |
Correct |
110 ms |
344 KB |
Output is correct |
12 |
Correct |
105 ms |
344 KB |
Output is correct |
13 |
Correct |
102 ms |
344 KB |
Output is correct |
14 |
Correct |
99 ms |
344 KB |
Output is correct |
15 |
Correct |
103 ms |
344 KB |
Output is correct |
16 |
Correct |
110 ms |
344 KB |
Output is correct |
17 |
Correct |
101 ms |
344 KB |
Output is correct |
18 |
Correct |
102 ms |
344 KB |
Output is correct |
19 |
Correct |
118 ms |
344 KB |
Output is correct |
20 |
Correct |
108 ms |
344 KB |
Output is correct |
21 |
Correct |
125 ms |
344 KB |
Output is correct |
22 |
Correct |
104 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 |
596 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
99 ms |
344 KB |
Output is correct |
7 |
Correct |
94 ms |
344 KB |
Output is correct |
8 |
Correct |
115 ms |
344 KB |
Output is correct |
9 |
Correct |
114 ms |
500 KB |
Output is correct |
10 |
Correct |
94 ms |
344 KB |
Output is correct |
11 |
Correct |
110 ms |
344 KB |
Output is correct |
12 |
Correct |
105 ms |
344 KB |
Output is correct |
13 |
Correct |
102 ms |
344 KB |
Output is correct |
14 |
Correct |
99 ms |
344 KB |
Output is correct |
15 |
Correct |
103 ms |
344 KB |
Output is correct |
16 |
Correct |
110 ms |
344 KB |
Output is correct |
17 |
Correct |
101 ms |
344 KB |
Output is correct |
18 |
Correct |
102 ms |
344 KB |
Output is correct |
19 |
Correct |
118 ms |
344 KB |
Output is correct |
20 |
Correct |
108 ms |
344 KB |
Output is correct |
21 |
Correct |
125 ms |
344 KB |
Output is correct |
22 |
Correct |
104 ms |
344 KB |
Output is correct |
23 |
Incorrect |
209 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 |
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 |
Incorrect |
205 ms |
344 KB |
Too many queries. |
8 |
Halted |
0 ms |
0 KB |
- |