# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
610359 | Jomnoi | 버섯 세기 (IOI20_mushrooms) | C++17 | 7 ms | 304 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 "mushrooms.h"
using namespace std;
int result;
vector <int> x;
vector <int> typeA, typeB;
int count_mushrooms(int N) {
typeA.push_back(0);
int i = 1;
while(typeA.size() < 140 and typeB.size() < 140 and i < N) {
result = use_machine({0, i});
if(result == 1) {
typeB.push_back(i);
}
else {
typeA.push_back(i);
}
i++;
}
int numberofA = 0, cnt;
while(i < N) {
if(typeA.size() > typeB.size()) {
x.clear();
cnt = 0;
for(int j = 0; j < typeA.size() - 1 and i < N; j++) {
x.push_back(typeA[j]);
x.push_back(i++);
cnt++;
}
x.push_back(typeA.back());
result = use_machine(x);
numberofA += cnt - result / 2;
}
else {
x.clear();
cnt = 0;
for(int j = 0; j < typeB.size() - 1 and i < N; j++) {
x.push_back(typeB[j]);
x.push_back(i++);
cnt++;
}
x.push_back(typeA.back());
result = use_machine(x);
numberofA += result / 2;
}
}
return numberofA + typeA.size();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |