Submission #581787

#TimeUsernameProblemLanguageResultExecution timeMemory
581787joelauCounting Mushrooms (IOI20_mushrooms)C++14
25 / 100
124 ms300 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; int count_mushrooms(int n) { int ans = 1; vector<int> v = {0,0,0}; for (int i = 1; i+1 < n; i += 2) { v[0] = i, v[2] = i+1; int x = use_machine(v); ans += 2-x; } if (n % 2 == 0) { v = {0,n-1}; int x = use_machine(v); ans += 1-x; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...