Submission #1136734

#TimeUsernameProblemLanguageResultExecution timeMemory
1136734vjudge2버섯 세기 (IOI20_mushrooms)C++20
0 / 100
0 ms420 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int K = 1; int count_mushrooms(int n) { int cnt = 1; vector<int> a, b; a.push_back(0); 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) { 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); } while (it < t.size()) v.push_back(t[it++]); int res = use_machine(v); cnt += (K - 1 - res / 2); } return cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...