#include <bits/stdc++.h>
#define ent '\n'
void move_inside(int i);
void move_outside(int i);
int press_button();
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 12;
struct Q{
int mid, l, r, i;
};
int cnt[maxn];
bool is[maxn];
int p[maxn];
int min_cardinality(int n){
int ans = 1e9;
for(int i=0;i<n;i++){
if(is[i]) continue;
vector<int> v = {i};
move_inside(i);
int val = 1;
for(int j=i+1;j<n;j++){
move_inside(j);
if(press_button() == val){
move_outside(j);
continue;
}
is[j] = 1;
v.push_back(j);
val++;
}
ans = min(ans, val);
while(v.size()){
move_outside(v.back());
v.pop_back();
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
92 ms |
344 KB |
Output is correct |
8 |
Correct |
20 ms |
344 KB |
Output is correct |
9 |
Correct |
16 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
64 ms |
344 KB |
Output is correct |
12 |
Correct |
3 ms |
344 KB |
Output is correct |
13 |
Correct |
11 ms |
344 KB |
Output is correct |
14 |
Correct |
5 ms |
344 KB |
Output is correct |
15 |
Correct |
9 ms |
344 KB |
Output is correct |
16 |
Correct |
13 ms |
344 KB |
Output is correct |
17 |
Correct |
15 ms |
344 KB |
Output is correct |
18 |
Correct |
10 ms |
344 KB |
Output is correct |
19 |
Correct |
19 ms |
344 KB |
Output is correct |
20 |
Correct |
44 ms |
344 KB |
Output is correct |
21 |
Correct |
60 ms |
344 KB |
Output is correct |
22 |
Correct |
96 ms |
600 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 |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
92 ms |
344 KB |
Output is correct |
8 |
Correct |
20 ms |
344 KB |
Output is correct |
9 |
Correct |
16 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
64 ms |
344 KB |
Output is correct |
12 |
Correct |
3 ms |
344 KB |
Output is correct |
13 |
Correct |
11 ms |
344 KB |
Output is correct |
14 |
Correct |
5 ms |
344 KB |
Output is correct |
15 |
Correct |
9 ms |
344 KB |
Output is correct |
16 |
Correct |
13 ms |
344 KB |
Output is correct |
17 |
Correct |
15 ms |
344 KB |
Output is correct |
18 |
Correct |
10 ms |
344 KB |
Output is correct |
19 |
Correct |
19 ms |
344 KB |
Output is correct |
20 |
Correct |
44 ms |
344 KB |
Output is correct |
21 |
Correct |
60 ms |
344 KB |
Output is correct |
22 |
Correct |
96 ms |
600 KB |
Output is correct |
23 |
Correct |
3 ms |
344 KB |
Output is correct |
24 |
Incorrect |
257 ms |
344 KB |
Too many queries. |
25 |
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 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
7 ms |
344 KB |
Output is correct |
8 |
Incorrect |
276 ms |
344 KB |
Too many queries. |
9 |
Halted |
0 ms |
0 KB |
- |