#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(a) (a).begin(), (a).end()
#define ll long long
const int mod = 1000002022;
vector<int> state, p;
int n, m;
vector<vector<int>> g;
template<typename T>
int len(T &a){return a.size();}
int min_cardinality(int n) {
vector<vector<int>> ar;
for(int i = 0; i < n; i ++){
move_inside(i);
int now = press_button();
if(now > len(ar)){
ar.push_back(vector<int>());
ar.back().push_back(i);
continue;
}
int l = -1, r = len(ar) - 1;
int j = r;
while(r - l > 1){
int m = (l + r) / 2;
while(j > m){
for(auto u : ar[j]){
move_outside(u);
}
j --;
}
while(j < m){
j ++;
for(auto u : ar[j]){
move_inside(u);
}
}
if(press_button() == j + 1){
r = m;
}else l = m;
}
while(j + 1 < len(ar)){
j ++;
for(auto u : ar[j]) move_inside(u);
}
ar[r].push_back(i);
}
int ans = n;
for(int i = 0; i < len(ar); i ++) ans = min(ans, len(ar[i]));
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong answer. |
3 |
Halted |
0 ms |
0 KB |
- |