Submission #154224

#TimeUsernameProblemLanguageResultExecution timeMemory
154224salexandruBulb Game (FXCUP4_bulb)C++17
0 / 100
3 ms376 KiB
#include <iostream> #include "bulb.h" using namespace std; pair<int, int> G[300003]; int nr; void dfs(int nod, int turns) { if(nod == -1) return; if(nod == -2) nr++; else { if(turns == 2) return; else if(turns == 1) dfs(G[nod].first, turns); else { dfs(G[nod].first, turns); dfs(G[nod].second, turns + 1); } } } int FindWinner(int T, std::vector<int> L, std::vector<int> R){ int N = L.size(); int i; for(i = 0; L[i] != -1 && L[i] != -2; i = L[i]); if(L[i] == -2) return 1; else { for(int i = 0; i < N; i++) { G[i] = {L[i], R[i]}; } dfs(0, 0); if(nr > 1) return 0; else return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...