이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include <iostream>
#include <vector>
using namespace std;
// <|°_°|>
// JeanBombeur & M. Broccoli
// The hardest choices require the strongest wills
// What is better - to be born good, or to overcome your evil nature with great effort ?
const int MAX_INSECTS = (2000);
vector <int> Alive;
vector <int> In;
vector <int> Out;
int nbTypes = 0;
int nbInsects;
int Check() {
int sz = Alive.size();
int value = (sz + nbTypes - 1) / nbTypes;
In.clear();
Out.clear();
for (int a : Alive)
{
move_inside(a);
if (press_button() > value)
move_outside(a), Out.push_back(a);
else
In.push_back(a);
}
for (int a : In)
move_outside(a);
if ((int)In.size() == value * nbTypes)
{
Alive = Out;
return value;
}
Alive = In;
return 0;
}
int min_cardinality(int N) {
nbInsects = N;
int ans = 1;
for (int i = 0; i < nbInsects; i ++)
{
move_inside(i);
if (press_button() > 1)
move_outside(i), Alive.push_back(i);
else
nbTypes ++, In.push_back(i);
}
for (int a : In)
move_outside(a);
while ((int)Alive.size() >= nbTypes)
ans += Check();
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |