#include <bits/stdc++.h>
using namespace std;
#include "insects.h"
int min_cardinality(int N) {
int l = 1, r = N;
auto check = [&](int x)->bool{
vector<int> crr;
for (int i = 0; i < x; i++){
crr.push_back(i);
move_inside(i);
}
bool boolean=false;
for (int i = x; i < N; i++){
move_inside(i);
crr.push_back(i);
if (press_button()>x){
move_outside(i);
crr.pop_back();
}
else boolean=true;
}
return boolean;
while (crr.size()){
move_outside(crr.back());
crr.pop_back();
}
};
while (l<r){
int mid = l+(r-l)/2;
if (check(mid)){
r=mid;
}
else {
l=mid+1;
}
}
return l;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 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 |
9 ms |
208 KB |
Output is correct |
8 |
Incorrect |
11 ms |
212 KB |
Wrong answer. |
9 |
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 |
1 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 |
9 ms |
208 KB |
Output is correct |
8 |
Incorrect |
11 ms |
212 KB |
Wrong answer. |
9 |
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 |
1 ms |
228 KB |
Output is correct |
5 |
Incorrect |
1 ms |
208 KB |
Wrong answer. |
6 |
Halted |
0 ms |
0 KB |
- |