結果

問題 No.408 五輪ピック
ユーザー TawaraTawara
提出日時 2016-08-05 23:27:26
言語 PyPy2
(7.3.15)
結果
MLE  
実行時間 -
コード長 499 bytes
コンパイル時間 1,902 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 159,360 KB
最終ジャッジ日時 2024-04-24 18:26:44
合計ジャッジ時間 12,440 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 76 ms
75,648 KB
testcase_02 AC 75 ms
75,520 KB
testcase_03 AC 77 ms
75,392 KB
testcase_04 AC 77 ms
75,648 KB
testcase_05 AC 170 ms
79,872 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 AC 128 ms
79,872 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 AC 124 ms
79,744 KB
testcase_15 AC 157 ms
79,744 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 108 ms
79,232 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,raw_input().split())
E = [[] for i in xrange(N)]
for i in xrange(M):
	A,B = map(lambda x:int(x)-1,raw_input().split())
	E[A].append(B)
	E[B].append(A)
for i in xrange(N):
	E[i].sort()
def check(gone,nxt):
	while gone:
		if gone % 10000 == nxt:
			return True
		gone /= 10000
	return False
def dfs(h,gone,num):
	if num == 5:
		if E[h][0] == 0:
			print "YES"
			quit()
	else:
		for nxt in E[h]:
			if check(gone,nxt):
				continue
			dfs(nxt,gone*10000+nxt,num+1)
dfs(0,0,1)
print "NO" 
0