답안 #150601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150601 2019-09-01T08:42:36 Z 먀(#3635, khsoo01) Bulb Game (FXCUP4_bulb) C++17
0 / 100
2 ms 380 KB
#include "bulb.h"
#include<bits/stdc++.h>
using namespace std;

const int N = 300005;

int n, ans[N][2];
vector<int> l, r;

bool ini[N];

bool getini (int I) {
	if(I < 0) return I == -1;
	return ini[I];
}

bool solve (int I, int V) {
	if(V < 0) return false;
	if(I < 0) return (V == 0);
	if(ans[I][V]) return ans[I][V] - 1;
	if(getini(r[I])) ans[I][V] |= solve(l[I], V);
	if(getini(l[I])) ans[I][V] |= solve(r[I], V-1);
	ans[I][V]++;
	return ans[I][V] - 1;
}

void calc (int I) {
	if(I < 0) return;
	calc(l[I]);
	calc(r[I]);
	ini[I] = getini(l[I]);
}

int FindWinner(int T, vector<int> L, vector<int> R){
	n = L.size();
	l = L; r = R;
	calc(0);
	return solve(0, 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -