# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1136734 | vjudge2 | Counting Mushrooms (IOI20_mushrooms) | C++20 | 0 ms | 420 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);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |