# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
172647 | top34051 | Bulb Game (FXCUP4_bulb) | C++17 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n, T;
vector<int> L, R;
int res[maxn], down[maxn];
void dfs(int u) {
if(u < 0) return ;
dfs(L[u]);
dfs(R[u]);
if(L[u] >= 0) res[u] = res[L[u]];
else res[u] = (L[u] == -1);
down[u] = (L[u] >= 0 ? down[L[u]] : 0) + 1;
}
int FindWinner(int turns, vector<int> leftChild, vector<int> rightChild){
T = turns; L = leftChild; R = rightChild;
n = (int)leftChild.size();
dfs(0);
if(res[0] == 1 && down[0] < n) return 1;
int x = 0;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |