# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149394 | 1 WA = 5 Push Up (#200) | Bulb Game (FXCUP4_bulb) | C++17 | 94 ms | 10032 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
int T;
vector <int> L, R;
int col[300010];
bool able[300010];
bool dummy;
void sub_tree(int x)
{
if (L[x] >= 0) sub_tree(L[x]);
if (R[x] >= 0) dummy = true, sub_tree(R[x]);
col[x] = L[x] >= 0 ? col[L[x]] : L[x];
able[x] = L[x] >= 0 ? able[L[x]] : false;
if (R[x] == -2 || (R[x] >= 0 && col[R[x]] == -2)) able[x] = true;
if (L[x] == -1 || (L[x] >= 0 && col[L[x]] == -1))
if (R[x] == -1 || (R[x] >= 0 && col[R[x]] == -1))
dummy = true;
}
bool main_line(int x)
{
if (R[x] < 0) return true;
sub_tree(R[x]);
if (!able[R[x]]) return true;
if (col[R[x]] == -2) return false;
if (L[x] < 0) return dummy;
return main_line(L[x]);
}
int FindWinner(int T_, std::vector<int> L_, std::vector<int> R_) {
T = T_;
L = L_; R = R_;
int N = L.size();
int x;
for (x = 0; x >= 0; x = L[x]);
if (x == -2) return 0;
if (main_line(0)) return 1;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |