Submission #307385

#TimeUsernameProblemLanguageResultExecution timeMemory
307385arthur_nascimentoCounting Mushrooms (IOI20_mushrooms)C++14
44.66 / 100
13 ms384 KiB
#include "mushrooms.h" #define pb push_back using namespace std; const int C = 100; int count_mushrooms(int n) { vector<int> A,B; A.pb(0); for(int i=1;i<min(C,n);i++){ vector<int> v; v.pb(0); v.pb(i); int x = use_machine(v); if(x) B.pb(i); else A.pb(i); } int ans = A.size(); int eff = 0; for(int i=C;i<n;){ int t = max(A.size(), B.size()); int use = 0; if(B.size() > A.size()) use = 1; vector<int> vec = A; if(use) vec = B; vector<int> v; eff = 0; for(int j=0;j<t;j++){ v.pb(vec[j]); if(j < t-1 && i+j < n) v.pb(i+j), eff++; } int x = use_machine(v); //printf("ff %d\n",eff); if(use) ans += x/2; else ans += eff - (x/2); i += t-1; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...