Submission #1185850

#TimeUsernameProblemLanguageResultExecution timeMemory
1185850islam_2010Counting Mushrooms (IOI20_mushrooms)C++20
10 / 100
52 ms420 KiB
#include <bits/stdc++.h> #include "mushrooms.h" using namespace std; int count_mushrooms(int n) { int cnt = 1; for (int i = 1; i + 1 < n; i += 2) { int res = use_machine({i, 0, i + 1}); if (res == 0) { cnt += 2; } else if (res == 1) { int res2 = use_machine({0, i}); if (res2 == 0) cnt++; else cnt++; } } if (n % 2 == 0) { int res = use_machine({0, n - 1}); if (res == 0) cnt++; } return cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...