제출 #1313705

#제출 시각아이디문제언어결과실행 시간메모리
1313705PlayVoltz버섯 세기 (IOI20_mushrooms)C++20
65.70 / 100
3 ms568 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int X=100; #define pb push_back #define mp make_pair #define pii pair<int, int> #define fi first #define se second int count_mushrooms(int n){ vector<int> ord; for (int i=1; i<n; ++i)ord.pb(i); vector<vector<int> > vect(2); vect[0].pb(0);// if (n<=227){ int res=1; for (int i=1; i<n; ++i)res+=!use_machine({0, i}); return res; } while (max(vect[0].size(), vect[1].size())<X){ if (use_machine({0, ord.back()}))vect[1].pb(ord.back()); else vect[0].pb(ord.back()); ord.pop_back(); } //while () int ans=vect[0].size(); while (ord.size()){ int id=0; if (vect[0].size()<vect[1].size())id=1; vector<int> temp; for (int i=0; i<vect[id].size()&&ord.size(); ++i)temp.pb(vect[id][i]), temp.pb(ord.back()), ord.pop_back(); int res=use_machine(temp); if (id)ans+=res/2+res%2; else ans+=temp.size()/2-(res/2+res%2); if (res%2)vect[!id].pb(temp.back()); else vect[id].pb(temp.back()); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...