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 <bits/stdc++.h>
using namespace std;
int min_cardinality(int N) {
vector<int> cur;
vector<int> each(N);
int ct = 0;
for (int i = 0; i < N; i++) {
cur.push_back(i);
move_inside(i);
int res = press_button();
if (res == 1)
each[i] = ct++;
else {
for (auto a : cur) {
move_outside(a);
res = press_button();
if (res == 1) {
each[i] = each[a];
break;
}
move_inside(a);
}
cur.pop_back();
}
}
map<int, int> mii;
for (auto a : each) mii[a]++;
vector<pair<int, int>> vpii;
for (auto [a, b] : mii) vpii.emplace_back(b, a);
sort(vpii.begin(), vpii.end());
return find(each.begin(), each.end(), vpii.front().second) - each.begin();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |