# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431879 | Ozy | Counting Mushrooms (IOI20_mushrooms) | C++17 | 110 ms | 276 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 lli long long int
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define repa(i,a,b) for(int i = (a); i >= (b); i--)
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "
lli res,a,pos;
int count_mushrooms(int n) {
res = 1;
rep(i,1,n/2) {
pos = i*2;
if (pos < n) {
a = use_machine({pos-1,0,pos});
if (a == 0) res += 2;
else if (a == 1) res++;
}
else {
a = use_machine({pos-1,0});
if (a == 0) res++;
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |