답안 #149253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149253 2019-09-01T06:04:10 Z rkm0959(#3623, jun6873, babo) Bulb Game (FXCUP4_bulb) C++17
0 / 100
3 ms 508 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];
	return x==-2;
}

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 x==-1;
}

bool existover2(int now,int dep, vector<int>&L, vector<int>&R){
	if(now<0) return 0;
	if(dep>2) return 1;
	return existover2(L[now],dep,L,R) or existover2(R[now],dep+1,L,R);
}

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)) return 0;
		temp=L[temp];
	}
	while(1) printf("%d\n",1/0);
	return existover2(0,0,L,R);
}

Compilation message

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:41:26: warning: division by zero [-Wdiv-by-zero]
  while(1) printf("%d\n",1/0);
                         ~^~
bulb.cpp:29:6: warning: unused variable 'i' [-Wunused-variable]
  int i;
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Runtime error 3 ms 508 KB Execution killed with signal 4 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -