Submission #150309

# Submission time Handle Problem Language Result Execution time Memory
150309 2019-09-01T08:06:24 Z 티셔츠 콜렉터(#3632, yoni, jisunchae, jsg1504) Bulb Game (FXCUP4_bulb) C++17
0 / 100
3 ms 504 KB
#include "bulb.h"

int Rcnt[300001];
int FindWinner1(int cur, std::vector<int> L, std::vector<int> R) {
	if (L[cur] >= 0) {
		Rcnt[L[cur]] = Rcnt[cur];
		int tmp = FindWinner1(L[cur], L, R);
		if (tmp == 1) return 1;
	} else if (L[cur] == -1) {
		if (Rcnt[cur] == 1) return 1;
	}
	
	if (R[cur] >= 0) {
		Rcnt[R[cur]] = Rcnt[cur]+1;
		int tmp = FindWinner1(R[cur], L, R);
		if (tmp == 1) return 1;
	} else if (R[cur] == -1) {
		if (Rcnt[cur] == 0) return 1;
	}

	return 0;
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R){
	int N = L.size();
	if (T == 1) {
		return FindWinner1(0, L, R);
	}
	return 0;
}

Compilation message

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:24:6: warning: unused variable 'N' [-Wunused-variable]
  int N = L.size();
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -