Submission #772396

#TimeUsernameProblemLanguageResultExecution timeMemory
772396t6twotwoCounting Mushrooms (IOI20_mushrooms)C++17
25 / 100
94 ms256 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) { int y = use_machine({0, N - 1}); ans += C ? -y : 1 - y; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...