# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147824 | 2019-08-30T19:53:39 Z | imsifile | Bulb Game (FXCUP4_bulb) | C++17 | 0 ms | 0 KB |
#include "bulb.h" using namespace std; int N, rule[303030]; vector<int> L, R; int dfs(int ix){ if(ix<0) return ix; if(rule[ix]==0) return dfs(L[ix]); return dfs(R[ix]); } int FindWinner(int N_, int T, std::vector<int> L_, std::vector<int> R_){ N=N_, L=L_, R=R_; for(int i=0; i<N; i++){ rule[i]^=1; int fl=1; for(int j=0; j<N; j++){ rule[j]^=1; int x=dfs(0); rule[j]^=1; if(x==-2){ fl=0; break; } } rule[i]^=1; if(fl) return 1; } return 0; }