제출 #150448

#제출 시각아이디문제언어결과실행 시간메모리
150448----MIT합격선---- (#200)Bulb Game (FXCUP4_bulb)C++17
0 / 100
2 ms376 KiB
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> L, R;

int f(int x, int c) {
	if (c == 0) {
		if (x < 0) return 0;
		if (f(R[x], 1)) return 1;
		int y = R[x];
		while (y >= 0) y = L[y];
		if (y != -1) return 0;
		return f(L[x], c);
	}
	if (c == 1) {
		if (x < 0) return 1;
		if (f(R[x], 2) == 0) return 0;
		return f(L[x], 1);
	}
	if (c == 2) {
		if (x < 0) return x == -1;
		return f(L[x], 2);
	}
}

int FindWinner(int T, std::vector<int> LL, std::vector<int> RR){
	L = LL, R = RR;
	N = L.size();
	int x = 0;
	while (x >= 0) x = L[x];
	if (x == -2) return 0;
	return f(0, 0);
}

컴파일 시 표준 에러 (stderr) 메시지

bulb.cpp: In function 'int f(int, int)':
bulb.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...