제출 #315646

#제출 시각아이디문제언어결과실행 시간메모리
315646Sorting버섯 세기 (IOI20_mushrooms)C++17
56.78 / 100
12 ms384 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int C = 200; int count_mushrooms(int n){ int cnt = 1; vector<int> a{0}, b; for(int i = 1; i < min(n, C + 1); ++i){ if(!use_machine(vector<int>{0, i})){ cnt++; a.push_back(i); } else b.push_back(i); } for(int i = min(n, C + 1); i < n; i += (C / 2)){ vector<int> v; int x = min(C / 2, n - i); if(a.size() > b.size()){ for(int j = 0; j < x; ++j){ v.push_back(a[j]); v.push_back(i + j); } v.push_back(a[x]); } else{ for(int j = 0; j < x; ++j){ v.push_back(b[j]); v.push_back(i + j); } v.push_back(b[x]); } int t = use_machine(v); if(a.size() > b.size()) cnt += x - t / 2; else cnt += t / 2; } return cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...