# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831164 | Baytoro | Counting Mushrooms (IOI20_mushrooms) | C++17 | 92 ms | 636 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 "stub.cpp"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(),x.end();
int count_mushrooms(int n) {
vector<int> a[2];
a[0].pb(0);
int last=1;
for(int i=1;i<n && max(a[0].size(),a[1].size())<2;i++){
if(use_machine({0,i})) a[1].pb(i);
else a[0].pb(i);
last++;
}
for(int i=last;i+1<n/* && a.size()<100 && b.size()<100*/;){
int x=0;
if(a[0].size()<2) x=1;
int cnt=use_machine({a[x][0],i,a[x][1],i+1});
if(cnt==0) {a[x].pb(i);a[x].pb(i+1);}
if(cnt==1) {a[x].pb(i);a[x^1].pb(i+1);}
if(cnt==2) {a[x].pb(i+1);a[x^1].pb(i);}
if(cnt==3) {a[x^1].pb(i);a[x^1].pb(i+1);}
i+=2;
last=i;
}
for(int i=last;i<n;i++){
if(use_machine({0,i})) a[1].pb(i);
else a[0].pb(i);
}
return a[0].size();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |