제출 #1192064

#제출 시각아이디문제언어결과실행 시간메모리
1192064alexddCounting Mushrooms (IOI20_mushrooms)C++20
0 / 100
2 ms436 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int LIM = 142; int count_mushrooms(int n) { vector<int> v[2]; v[0].push_back(0); int ult=0; for(int i=1;i<n;i++) { v[0].push_back(i); if(use_machine(v[0])==0) { } else { v[0].pop_back(); v[1].push_back(i); } ult = i; //if(max(v[0].size(), v[1].size()) >= LIM) break; if(v[0].size() >= LIM) break; } if(ult==n-1) return v[0].size(); int cnt = v[0].size(); if(v[0].size() >= LIM) { for(int i=ult+1;i<n;i+=v[0].size()) { vector<int> newv; for(int j=0;j<v[0].size();j++) { newv.push_back(v[0][j]); if(i+j < n) newv.push_back(i+j); } int x = use_machine(newv); cnt += (x+1)/2; } } else { assert(0); assert(v[1].size() >= LIM); } return cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...