Submission #149111

# Submission time Handle Problem Language Result Execution time Memory
149111 2019-09-01T05:45:42 Z rkm0959(#3623, jun6873, babo) Bulb Game (FXCUP4_bulb) C++17
0 / 100
2 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

bool bad(int x, vector<int>&L, vector<int>&R){
	x=R[x];
	while(x>=0)
		x=L[x];
	if(x==-2) return 1;
	return 0;
}

bool ok(int x, vector<int>&L, vector<int>&R){
	x=R[x];
	while(x>=0)
	{
		if(bad(x,L,R)) return 0;
		x=L[x];
	}
	return 1;
}

int FindWinner(int T, vector<int>L, vector<int>R){
	int i;
	int temp=0;
	while(temp>=0)
		temp=L[temp];
	if(temp==-2) return 0;
	temp=0;
	while(temp>=0)
	{
		if(ok(temp,L,R)) return 1;
		if(bad(temp,L,R)) break;
		temp=L[temp];
	}
	return 0;
}

Compilation message

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:24:6: warning: unused variable 'i' [-Wunused-variable]
  int i;
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Incorrect 2 ms 292 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 2 ms 292 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 2 ms 292 KB Output isn't correct
5 Halted 0 ms 0 KB -