結果
問題 |
No.228 ゆきこちゃんの 15 パズル
|
ユーザー |
![]() |
提出日時 | 2017-12-05 14:12:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 734 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-28 16:36:58 |
合計ジャッジ時間 | 1,708 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 17 |
ソースコード
def around(pos): ls = [] #上 if pos >= 4: ls.append(pos - 4) #下 if pos <= 11: ls.append(pos + 4) #左 if pos % 4 != 0: ls.append(pos - 1) #右 if pos % 4 != 3: ls.append(pos + 1) return ls def check(ls): pos = ls.index('0') g = goal[pos] for p in around(pos): if ls[p] == g: ls[p], ls[pos] = ls[pos], ls[p] return True return False a = input().split() b = input().split() c = input().split() d = input().split() ls = a + b + c + d goal = [str((i + 1) % 16) for i in range(16)] while True: if ls == goal: print('YES') break if not check(ls): print('NO') break