제출 #831164

#제출 시각아이디문제언어결과실행 시간메모리
831164Baytoro버섯 세기 (IOI20_mushrooms)C++17
25 / 100
92 ms636 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 && 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 timeMemoryGrader output
Fetching results...