# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
628215 | galca | Rarest Insects (IOI22_insects) | C++17 | 298 ms | 208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "insects.h"
#include <vector>
using namespace std;
int min_cardinality(int N) {
vector<int> vec1;
vector<int> vec2;
int remaining = N;
int min_card = N;
int dir = 0;
for (int i = 0; i < N; i++) {
vec1.push_back(i);
}
while (remaining > 0) {
vector<int>& src = dir ? vec2 : vec1;
vector<int>& dst = dir ? vec1 : vec2;
move_inside(src[0]);
int size = 1;
for (int i = 1; i < src.size(); i++) {
move_inside(src[i]);
int res = press_button();
if (res != 2) {
dst.push_back(i);
}
else {
++size;
}
move_outside(src[i]);
}
if (size < min_card) {
min_card = size;
}
src.erase(src.begin(), src.end());
remaining -= size;
dir ^= 1;
}
return min_card;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |