結果

問題 No.240 ナイト散歩
ユーザー No
提出日時 2017-05-16 01:11:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-07 21:39:02
合計ジャッジ時間 2,168 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def add(a = 0,b = 0):
    s = str(a) + "," + str(b)
    if s not in li:
        li2.append(s)

ss = input().split()

z = ss[0] + "," + ss[1]

li = ["0,0"]
li2 = []
f = 0

for i in range(3):
    for j in range(f,len(li)):
        ss = li[j].split(',')
        x = int(ss[0])
        y = int(ss[1])

        a = x - 2
        b = y - 1
        add(a,b)
        a = x - 2
        b = y + 1
        add(a,b)
        a = x - 1
        b = y - 2
        add(a,b)
        a = x - 1
        b = y + 2
        add(a,b)
        a = x + 1
        b = y - 2
        add(a,b)
        a = x + 1
        b = y + 2
        add(a,b)
        a = x + 2
        b = y - 1
        add(a,b)
        a = x + 2
        b = y + 1
        add(a,b)
        
    f = len(li)
    li += li2
    li2.clear()
        
if z in li:
    print("YES")
else:
    print("NO")
0