| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 629214 | flashmt | 드문 곤충 (IOI22_insects) | C++17 | 68 ms | 456 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 <bits/stdc++.h>
#include "insects.h"
using namespace std;
pair<vector<int>, vector<int>> findFirstOccurrences(vector<int> id, int maxC)
{
vector<int> good, bad;
for (int i : id)
{
move_inside(i);
if (press_button() <= maxC) good.push_back(i);
else
{
move_outside(i);
bad.push_back(i);
}
}
for (int i : good)
move_outside(i);
return {good, bad};
}
int min_cardinality(int n)
{
vector<int> id(n);
iota(begin(id), end(id), 0);
auto [good, bad] = findFirstOccurrences(id, 1);
int typeCnt = size(good);
int low = 2, high = n / typeCnt, ans = 1;
id = bad;
while (low <= high)
{
int mid = (low + high + 1) / 2;
tie(good, bad) = findFirstOccurrences(id, mid - ans);
if (size(good) == typeCnt * (mid - ans))
{
ans = mid;
low = mid + 1;
id = bad;
}
else
{
high = min(mid - 1, int(size(good)) / typeCnt + ans);
id = good;
}
}
return ans;
}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... | ||||
