Submission #149914

#TimeUsernameProblemLanguageResultExecution timeMemory
149914Little Piplup (#200)Bulb Game (FXCUP4_bulb)C++17
36 / 100
1080 ms7440 KiB
#include "bulb.h" int n; std::vector <int> Left, Right; int check_which_bulb(std::vector <bool> &bt) { int ans = 0; while(ans >= 0) { if (bt[ans]) ans = Right[ans]; else ans = Left[ans]; } return ans; } bool redhub(std::vector <bool> bt) { for (int i = 0; i<n; i++) { if (bt[i]) continue; else { bt[i] = true; int u = check_which_bulb(bt); if (u == -2) return false; bt[i] = false; } } return true; } int FindWinner(int T, std::vector<int> L, std::vector<int> R) { Left = L, Right = R; int N = L.size(); n = N; std::vector <bool> on (N, false); int start = check_which_bulb(on); //printf("%d\n", start); if (start == -2) return 0; for (int i = 0; i<N; i++) { on[i] = true; if (redhub(on)) { //printf("Redhub found %d\n",i); return 1; } on[i] = false; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...