結果

問題 No.240 ナイト散歩
ユーザー tookunn_1213
提出日時 2015-12-13 11:22:59
言語 Python2
(2.7.18)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-07 21:17:04
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

MIN = -1000000000
MAX = 1000000000
def dfs(nox,noy,count):
	global x,y,MIN,MAX
	dx = [-2,-2,-1,-1,1,1,2,2]
	dy = [-1,1,-2,2,-2,2,-1,1]
	if count == 4:return False
	if nox == x and noy == y:
		return True
	ret = False
	for i in range(len(dx)):
		nx,ny = dx[i] + nox,dy[i] + noy
		if nx < MIN or nx > MAX or ny < MIN or ny > MAX:continue
		ret = ret or dfs(nx,ny,count + 1)
	return ret
x,y = map(long,raw_input().split())
if dfs(0,0,0):
	print 'YES'
else:
	print 'NO'
0