結果

問題 No.228 ゆきこちゃんの 15 パズル
ユーザー roiti46
提出日時 2015-06-19 22:34:09
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 04:06:24
合計ジャッジ時間 817 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

dxy = zip([0, 1, 0, -1, 0], [0, 0, 1, 0, -1])
a = [map(int, raw_input().split()) for i in xrange(4)]
b = [[j % 16 for j in xrange(4 * i + 1, 4 * i + 5)] for i in xrange(4)]

for y in xrange(4):
        for x in xrange(4):
                for dx, dy in dxy:
                        nx, ny = x + dx, y + dy
                        if not (0 <= nx < 4 and 0 <= ny < 4): continue
                        if a[ny][nx] == b[y][x]:
                                break
                else:
                        print "No"
                        exit()
print "Yes"
0