Submission #1136732

#TimeUsernameProblemLanguageResultExecution timeMemory
1136732vjudge2Counting Mushrooms (IOI20_mushrooms)C++20
0 / 100
0 ms428 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int K = 138; int count_mushrooms(int n) { int cnt = 1; vector<int> a, b; for (int i = 1; i <= min(n - 1, K); i++) { vector<int> m = {0, i}; int res = use_machine(m); if (!res) cnt++, a.push_back(i); else b.push_back(i); } vector<int> t; int breh = 1; for (int i : a) { breh++; t.push_back(i); } for (int i : b) t.push_back(i); for (int i = K + 1; i < n; i += K - 1) { vector<int> v; int it = 0; for (int j = i; j <= min(n-1, i + K - 1 - 1); j++) { v.push_back(t[it++]); if (it == breh) v.push_back(t[it++]); v.push_back(j); } v.push_back(t[it]); int res = use_machine(v); cnt += (K - 1 - res / 2); } return cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...