Submission #150360

# Submission time Handle Problem Language Result Execution time Memory
150360 2019-09-01T08:12:57 Z ----MIT합격선----(#3601, maruii, Diuven, andy627) Bulb Game (FXCUP4_bulb) C++17
0 / 100
2 ms 376 KB
#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 x == -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);
}

Compilation message

bulb.cpp: In function 'int f(int, int)':
bulb.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -