Submission #831163

#TimeUsernameProblemLanguageResultExecution timeMemory
831163BaytoroCounting Mushrooms (IOI20_mushrooms)C++17
0 / 100
0 ms208 KiB
#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 && (int)a[0].size()<2 && (int)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*/;i++){ 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++; 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 timeMemoryGrader output
Fetching results...