# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
458000 | rainboy | 버섯 세기 (IOI20_mushrooms) | C++17 | 2 ms | 200 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 "mushrooms.h"
#include <iostream>
using namespace std;
typedef vector<int> vi;
const int N = 100;
int aa[N], bb[N];
int count_mushrooms(int n) {
vi ii;
int na, nb, h, i, ans;
na = nb = 0;
aa[na++] = 0;
for (i = 1; i < n && na < N && nb < N; i++) {
ii.resize(2);
ii[0] = 0, ii[1] = i;
if (use_machine(ii) == 0)
aa[na++] = i;
else
bb[nb++] = i;
}
if (i == n)
return na;
if (na == N) {
ans = n - nb;
while (i < n) {
ii.resize(0);
for (h = 0; h < na; h++) {
ii.push_back(aa[h]);
if (i < n)
ii.push_back(i++);
}
ans -= (use_machine(ii) + 1) / 2;
}
} else {
ans = na;
while (i < n) {
for (h = 0; h < nb; h++) {
ii.push_back(bb[h]);
if (i < n)
ii.push_back(i++);
}
ans += (use_machine(ii) + 1) / 2;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |