結果
問題 | No.228 ゆきこちゃんの 15 パズル |
ユーザー |
![]() |
提出日時 | 2019-12-14 11:34:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 5,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 261 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-28 03:09:34 |
合計ジャッジ時間 | 1,806 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
a = [list(map(int, input().split())) for _ in range(4)] c = [[(i+j)%16 for i in range(1, 5)] for j in range(0,16,4)] dy = [-1, 0, 1, 0] dx = [0, -1, 0, 1] loop = True while loop: for y in range(4): for x in range(4): if a[y][x] == 0: for k in range(4): ty = dy[k] + y tx = dx[k] + x if 0 <= ty < 4 and 0 <= tx < 4 and a[ty][tx] == c[y][x]: a[y][x], a[ty][tx] = a[ty][tx], a[y][x] break else: loop = False print('Yes' if a == c else 'No')