#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define sz(x) (ll)x.size()
#define F first
#define S second
#define MID ((l+r)/2)
#define pb push_back
#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;
#define dbg4(x,y,z,w) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#w<<": "<<w<<endl;
#define dbg5(x,y,z,w,q) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#w<<": "<<w<<" "<<#q<<": "<<q<<endl;
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
#define MOD 1000002022
#define inf 1e9
int min_cardinality(int N){
ll n = N;
vi vis(n, 0);
int ans =inf;
for (ll i =0; i<n; i++){
if (!vis[i]){
ll c = 1;
vis[i] = 1;
move_inside(i);
for (ll j=i+1; j<n; j++){
move_inside(j);
ll val = press_button();
if (val == 2){
c++;
vis[j] = 1;
}
move_outside(j);
}
move_outside(i);
ans = min(ans, c);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
2 ms |
208 KB |
Output is correct |
7 |
Correct |
123 ms |
208 KB |
Output is correct |
8 |
Correct |
18 ms |
208 KB |
Output is correct |
9 |
Correct |
19 ms |
208 KB |
Output is correct |
10 |
Correct |
4 ms |
208 KB |
Output is correct |
11 |
Correct |
54 ms |
208 KB |
Output is correct |
12 |
Correct |
7 ms |
208 KB |
Output is correct |
13 |
Correct |
13 ms |
208 KB |
Output is correct |
14 |
Correct |
9 ms |
208 KB |
Output is correct |
15 |
Correct |
14 ms |
208 KB |
Output is correct |
16 |
Correct |
14 ms |
208 KB |
Output is correct |
17 |
Correct |
18 ms |
208 KB |
Output is correct |
18 |
Correct |
22 ms |
208 KB |
Output is correct |
19 |
Correct |
20 ms |
208 KB |
Output is correct |
20 |
Correct |
61 ms |
208 KB |
Output is correct |
21 |
Correct |
96 ms |
208 KB |
Output is correct |
22 |
Correct |
129 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
2 ms |
208 KB |
Output is correct |
7 |
Correct |
123 ms |
208 KB |
Output is correct |
8 |
Correct |
18 ms |
208 KB |
Output is correct |
9 |
Correct |
19 ms |
208 KB |
Output is correct |
10 |
Correct |
4 ms |
208 KB |
Output is correct |
11 |
Correct |
54 ms |
208 KB |
Output is correct |
12 |
Correct |
7 ms |
208 KB |
Output is correct |
13 |
Correct |
13 ms |
208 KB |
Output is correct |
14 |
Correct |
9 ms |
208 KB |
Output is correct |
15 |
Correct |
14 ms |
208 KB |
Output is correct |
16 |
Correct |
14 ms |
208 KB |
Output is correct |
17 |
Correct |
18 ms |
208 KB |
Output is correct |
18 |
Correct |
22 ms |
208 KB |
Output is correct |
19 |
Correct |
20 ms |
208 KB |
Output is correct |
20 |
Correct |
61 ms |
208 KB |
Output is correct |
21 |
Correct |
96 ms |
208 KB |
Output is correct |
22 |
Correct |
129 ms |
208 KB |
Output is correct |
23 |
Correct |
9 ms |
208 KB |
Output is correct |
24 |
Incorrect |
265 ms |
208 KB |
Too many queries. |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
16 ms |
208 KB |
Output is correct |
8 |
Incorrect |
164 ms |
208 KB |
Too many queries. |
9 |
Halted |
0 ms |
0 KB |
- |