Submission #1297223

#TimeUsernameProblemLanguageResultExecution timeMemory
1297223kawhietCounting Mushrooms (IOI20_mushrooms)C++20
10 / 100
55 ms400 KiB
#include <bits/stdc++.h> #include "mushrooms.h" using namespace std; int count_mushrooms(int n) { int res = 1, prv = 0; for (int i = 1; i < n; i++) { int x = use_machine({i - 1, i}); if (prv == 0 && x == 0) { res++; } else if (prv == 1 && x == 1) { res++; } if (x == 1) { prv ^= 1; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...