Submission #148991

# Submission time Handle Problem Language Result Execution time Memory
148991 2019-09-01T05:31:02 Z =SUM(D1:D9)(#3629, ydk1104, stet_stet, Hyperbolic) Bulb Game (FXCUP4_bulb) C++17
0 / 100
1000 ms 380 KB
#include "bulb.h"

int FindWinner(int T, std::vector<int> R, std::vector<int> L){
	int N = L.size();
	int now = 0;
	std::vector<int> v;
	while(R[now]>=0){
		v.push_back(L[now]);
		now = R[now];
	}
	if(R[now] == -2) return 0;
	int cnt=0;
	for(auto &i : v){
		int check = 1;
		while(R[i] >= 0){
			int temp = L[i];
			while(L[i]>=0) temp = R[temp];
			if(temp == -1) check=0;
			i = R[i];
		}
		if(i == -2 && check) return 0;
		if(i == -2) cnt++;
	}
	if(cnt>1) return 0;
	return 1;
}

Compilation message

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:4:6: warning: unused variable 'N' [-Wunused-variable]
  int N = L.size();
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Execution timed out 1018 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 300 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 300 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct