# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
313931 | srvlt | Counting Mushrooms (IOI20_mushrooms) | C++14 | 195 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define SZ(x) (int)(x).size()
#define all(x) begin(x), end(x)
int count_mushrooms(int n) {
vector<int> m, c(n);
int res = 1;
for (int i = 1; i < n; i++) {
m.clear();
m.pb(i - 1), m.pb(i);
if (use_machine(m)) c[i] = c[i - 1] ^ 1;
else c[i] = c[i - 1];
res += (c[i] == 0);
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |