Submission #346208

#TimeUsernameProblemLanguageResultExecution timeMemory
346208SecretKCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
1 ms364 KiB
#include "mushrooms.h" int count_mushrooms(int n) { std::vector<int> m; int a = 0,t; int ans = 1; for (int i = 1; i < n-1; i+=3){ m = {i-1}; for(int j = i;j < i+2;j++){ m.push_back(j); } t = use_machine(m); if(t == 0){ if(!a) ans += 3; } if(t == 2){ if(a){ ans++; a = (a+1)%2; } else { ans += 2; a = (a+1)%2; } } if(t == 1){ t = use_machine({i-1,i}); if(t && a) ans++; if(t && !a) ans += 2; if(!t && a) ans++; if(!t && !a) ans += 2; a = (a+1)%2; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...