結果

問題 No.240 ナイト散歩
ユーザー TawaraTawara
提出日時 2015-07-19 14:44:05
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 6,624 KB
実行使用メモリ 6,000 KB
最終ジャッジ日時 2023-09-22 19:17:49
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,000 KB
testcase_01 AC 11 ms
5,936 KB
testcase_02 AC 11 ms
5,984 KB
testcase_03 AC 11 ms
5,868 KB
testcase_04 AC 11 ms
5,996 KB
testcase_05 WA -
testcase_06 AC 10 ms
5,864 KB
testcase_07 AC 10 ms
5,944 KB
testcase_08 AC 11 ms
6,000 KB
testcase_09 AC 11 ms
5,936 KB
testcase_10 AC 11 ms
5,944 KB
testcase_11 AC 10 ms
5,936 KB
testcase_12 AC 11 ms
5,868 KB
testcase_13 AC 10 ms
5,828 KB
testcase_14 AC 11 ms
5,824 KB
testcase_15 AC 11 ms
5,872 KB
testcase_16 AC 10 ms
5,864 KB
testcase_17 AC 11 ms
5,928 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 11 ms
5,928 KB
testcase_21 AC 10 ms
5,940 KB
testcase_22 AC 10 ms
5,824 KB
testcase_23 AC 10 ms
5,824 KB
testcase_24 WA -
testcase_25 AC 10 ms
5,932 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 10 ms
5,828 KB
testcase_29 AC 11 ms
5,932 KB
testcase_30 AC 10 ms
5,860 KB
testcase_31 AC 11 ms
5,928 KB
testcase_32 AC 10 ms
5,880 KB
testcase_33 AC 11 ms
5,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(hp, hs):
	visit.add(hp)
	if hp == goal:
		return True
	ret = False
	for dx,dy in dxy:
		nxt = (hp[0]+dx, hp[1]+dy)
		if nxt not in visit and hs > 0:
			ret |= dfs(nxt,hs-1)
	return ret
dxy = ((-2,-1),(-2,1),(-1,-2),(-1,2),(1,-2),(1,2),(2,-1),(2,1))
goal = tuple(map(int,raw_input().split(" ")))
visit = set()
print "YES" if dfs((0,0),3) else "NO"
0