結果

問題 No.408 五輪ピック
ユーザー TawaraTawara
提出日時 2016-08-05 23:35:12
言語 PyPy2
(7.3.15)
結果
MLE  
実行時間 -
コード長 502 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 160,640 KB
最終ジャッジ日時 2024-04-24 19:30:21
合計ジャッジ時間 12,816 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 80 ms
75,392 KB
testcase_02 AC 81 ms
75,264 KB
testcase_03 AC 81 ms
75,264 KB
testcase_04 AC 80 ms
75,136 KB
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 AC 138 ms
79,744 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 137 ms
79,744 KB
testcase_14 AC 121 ms
79,492 KB
testcase_15 AC 134 ms
79,616 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 113 ms
78,976 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 TLE -
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+1):
				continue
			dfs(nxt,gone*10000+nxt+1,num+1)
dfs(0,1,1)
print "NO"
0