Submission #149326

#TimeUsernameProblemLanguageResultExecution timeMemory
149326=SUM(D1:D9) (#200)Bulb Game (FXCUP4_bulb)C++17
0 / 100
4 ms376 KiB
#include "bulb.h" int FindWinner(int T, std::vector<int> R, std::vector<int> L){ int N = L.size(); if(N==1){ return R[0] == -1 ? 1 : 0; } int now = 0; std::vector<int> v; while(R[now]>=0){ v.push_back(L[now]); now = R[now]; } v.push_back(L[now]); if(R[now] == -2) return 0; int cnt=0; for(auto &i : v){ int check = 1; while(i >= 0){ int temp = L[i]; while(temp>=0) temp = R[temp]; if(temp == -1) check=0; i = R[i]; } int temp = L[i]; while(temp>=0) temp = R[temp]; if(temp==-1) check=0; if(i == -2 && check) return 0; if(i == -2) cnt++; } if(cnt>1) return 0; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...