Submission #772395

#TimeUsernameProblemLanguageResultExecution timeMemory
772395t6twotwoCounting Mushrooms (IOI20_mushrooms)C++17
0 / 100
1 ms208 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; int count_mushrooms(int N) { if (N == 2) { return 2 - use_machine({0, 1}); } int A = use_machine({0, 1}); int B = use_machine({0, 2}); bool C = 0; int ans; if (A == 0) { ans = 3 - B; A = 0; B = 1; } else if (B == 0) { ans = 2; A = 0; B = 2; } else { ans = N - 2; A = 1; B = 2; C = 1; } for (int i = 3; i + 1 < N; i += 2) { int x = use_machine({A, i, B, i + 1}), y; if (x == 0) { y = 2; } else if (x == 3) { y = 0; } else { y = 1; } ans += C ? -y : y; } if (N % 2 == 0) { ans += 1 - use_machine({0, N - 1}); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...