# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1074218 | fv3 | 디지털 회로 (IOI22_circuit) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int min_cardinality(int N)
{
// Find the number of different insect types:
// Maximum number of insects with 1 being maximum
// Let that number be K
// Find another set of K numbers with 2 being the maximum
// Then 3 and 4 and so on untill it is no longer possible
// The grader is not adaptive:
vector<int> indicies(N);
iota(indicies.begin(), indicies.end(), 0);
mt19937 mt(time(0));
shuffle(indicies.begin(), indicies.end(), mt);
vector<int> in(N);
int k = 0;
for (int i = 0; i < N; i++)
{
move_inside(indicies[i]);
if (press_button() > 1)
{
move_outside(indicies[i]);
}
else
{
k++;
in[i] = 1;
}
}
cerr << k << '\n';
int res = 1;
while (true)
{
int cnt = 0;
for (int i = 0; i < N && cnt < k; i++)
{
if (in[i]) continue;
move_inside(indicies[i]);
if (press_button() > res + 1)
{
move_outside(indicies[i]);
}
else
{
cnt++;
in[i] = 1;
}
}
if (cnt < k)
return res;
res++;
}
return res;
}