結果
| 問題 |
No.240 ナイト散歩
|
| ユーザー |
tnoda_
|
| 提出日時 | 2015-08-26 14:24:28 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 390 bytes |
| コンパイル時間 | 93 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 21:04:49 |
| 合計ジャッジ時間 | 1,287 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
def moves(x, y):
dx = (-2, -2, -1, -1, +1, +1, +2, +2)
dy = (-1, +1, -2, +2, -2, +2, -1, +1)
return [(x+dx[i], y+dy[i]) for i in range(8)]
X, Y = map(int, raw_input().split())
pos = set([(X, Y)])
for i in range(3):
s = set(pos)
for (x0, y0) in s:
for (x, y) in moves(x0, y0):
pos.add((x, y))
if (0, 0) in pos:
print('YES')
else:
print('NO')
tnoda_