# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
605041 | lcj | Counting Mushrooms (IOI20_mushrooms) | C++17 | 0 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#include "mushrooms.h"
static int aim = 101;
int count_mushrooms(int n) {
vector<int> a;
vector<int> b;
a.push_back(0);
int last;
for (int i = 1; i < n; i++)
{
last = i;
int res = use_machine({0, i});
if (res) {
b.push_back(i);
}
else {
a.push_back(i);
}
if (a.size() == aim || b.size() == aim) break;
}
int rcount = a.size();
int bcount = n - a.size();
for (int i = last; i < n; i += aim-1)
{
vector<int> &inter = a.size() == aim ? a : b;
vector<int> q;
for (int j = 0; j < aim-1; j++)
{
q.push_back(inter[j]);
q.push_back(i+j);
}
q.push_back(inter.back());
int res = use_machine(q);
if (a.size() == aim) {
bcount -= res;
}
else {
rcount += res;
}
}
if (a.size() == aim) {
return n-bcount;
}
return rcount;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |