# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424123 | Supersonic | Counting Mushrooms (IOI20_mushrooms) | C++14 | 144 ms | 244 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 <bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
vector<int> a={0};
vector<int> b;int c=1;
while(a.size()<2&&b.size()<2&&c<n){
int k=use_machine({0,c});
if(k==1)b.push_back(c);else a.push_back(c);
c++;
}
int ca=a.size(),cb=b.size();
if(c==n)return ca;
if(a.size()==2){
//cerr<<a[0]<<':'<<a[1]<<endl;
while(c<n-1){
cb+=(use_machine({a[0],c,a[1],c+1})+1)/2;c+=2;
}
if(c<n)cb+=use_machine({a[0],c});
return n-cb;
}
else {
while(c<n-1){
ca+=(use_machine({b[0],c,b[1],c+1})+1)/2;c+=2;
}
if(c<n)ca+=use_machine({b[0],c});
return ca;
}
exit(1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |