이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int tc, n;
vi M;
void mi(int i) {
move_inside(i);
M.push_back(i);
}
void mo(int i = 0) {
move_outside(M.back());
M.pop_back();
}
bool tjek(int g) {
int ctr = n;
while(M.size() > 1) mo();
for(int i = 1; i < n; i++) {
mi(i);
if(press_button() > g) ctr--, mo(i);
}
return (ctr == g*tc);
}
int min_cardinality(int N) {
tc = n = N; mi(0);
for(int i = 1; i < n; i++) {
mi(i);
if(press_button() > 1) tc--, mo(i);
}
int l = 1, u = n;
while(l < u) {
int g = (l+u+1)/2;
if(tjek(g)) l = g;
else u = g-1;
}
return l;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |