Submission #149907

#TimeUsernameProblemLanguageResultExecution timeMemory
149907잉여로운 고3 (#200)Bulb Game (FXCUP4_bulb)C++17
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include "bulb.h" using namespace std; typedef tuple <int, int, int, int, int> tii; vector <int> L, R; int n; tii dfs(int p) { int d0, d1, d2, d3, s; int l0, l1, l2, l3, ls; int r0, r1, r2, r3, rs; if(p < 0) d0 = -p, d1 = d2 = d3 = s = 0; else{ tie(l0, l1, l2, l3, ls) = dfs(L[p]); tie(r0, r1, r2, r3, rs) = dfs(R[p]); s = ls + rs + 1; d0 = l0; d1 = l1 | r0; if(rs) d1 |= l0; d2 = l2 | r0; if(rs) d2 |= l0; d3 = d0; if(d0 == 1){ if((l1 & 1) && !(l3 & 2) && r0 != 2) {} else if(!(r2 & 2)) {} else if(rs && !(l2 & 2) && (r1 & 1)) {} else d3 |= 2; } else{ if((l1 & 2) && !(l3 & 1) && r0 != 1) {} else if(!(r2 & 1)) {} else if(rs && !(l2 & 1) && (r1 & 2)) {} else d3 |= 1; } } return tii(d0, d1, d2, d3, s); } int FindWinner(int T, vector <int> _L, vector<int> _R) { n = L.size(); swap(L, _L); swap(R, _R); int d0, d1, d2, d3, s; tie(d0, d1, d2, d3, s) = dfs(0); if(d3 | 2) return 0; else return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...