結果

問題 No.240 ナイト散歩
ユーザー nola_suz
提出日時 2015-07-13 13:34:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-07 20:56:59
合計ジャッジ時間 2,028 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
dd = [1,-1,2,-2]
x,y = list(map(int,input().split()))
a=[[0,0]]
f=False
n = 1
cnt = 1
for o in range(3):
	for i in range(n):
		for dx in dd:
			for dy in dd:
				if math.fabs(dx) == math.fabs(dy):
					continue
				a.append([a[i][0]+dx,a[i][1]+dy])
				if a[i][0]+dx == x and a[i][1]+dy == y:
					f=True
				cnt+=1
	n=cnt
if f:
	print("YES")
else:
	print("NO")
0