# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304371 | QAQAutoMaton | Counting Mushrooms (IOI20_mushrooms) | C++17 | 12 ms | 384 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<algorithm>
int solve(int n,std::vector<int> &a){
std::vector<int> b;
int st=200,ans=0;
while(st<n){
int m=std::min(n-st,(int)a.size());
b.clear();
for(int i=0;i<m;++i){
b.emplace_back(st+i);
b.emplace_back(a[i]);
}
ans+=(use_machine(b)+1)>>1;
st+=m;
}
return ans;
}
int count_mushrooms(int n) {
std::vector<int> A(0),B(0);
A.emplace_back(0);
for(int i=1;i<200 && i<n;++i){
if(use_machine({0,i}))B.emplace_back(i);
else A.emplace_back(i);
}
if(n<=200)return A.size();
if(A.size()>B.size()){
return A.size()+(n-200)-solve(n,A);
}
else{
return A.size()+solve(n,B);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |