Submission #1014846

#TimeUsernameProblemLanguageResultExecution timeMemory
1014846UnforgettableplCounting Mushrooms (IOI20_mushrooms)C++17
0 / 100
82 ms596 KiB
#include <bits/stdc++.h> using namespace std; int use_machine(vector<int> x); int count_mushrooms(int n) { vector<bool> type(n); { int t = use_machine({0,1}); if(t==0)type[1]=false; else type[1]=true; } if(n>2){ int t = use_machine({0,2}); if(t==0)type[2]=false; else type[2]=true; } else { return 1 + type[1]==false; } int a,b;bool ty; if(type[0]==type[1]){ a = 0; b = 1; ty = false; } else if(type[0]==type[2]){ a = 0; b = 2; ty = false; } else { a = 1; b = 2; ty = true; } type.emplace_back(false); for(int i=3;i<n;i+=2){ int curr; if(i==n-1){ curr = use_machine({a,i,b}); } else { curr = use_machine({a,i,b,i+1}); } if(curr&1){ type[i+1] = !ty; } else type[i+1] = ty; if(curr&2){ type[i] = !ty; } else type[i] = ty; } int ans = 0; for(int i=0;i<n;i++)if(type[i]==false)ans++; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...