結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー |
![]() |
提出日時 | 2022-05-31 16:03:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,221 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 82,748 KB |
最終ジャッジ日時 | 2024-09-21 01:19:06 |
合計ジャッジ時間 | 31,109 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 23 RE * 1 |
ソースコード
W, H, X = map(int, input().split())ans = [[0]*(W+1) for _ in range(H+1)]x1 = [1, 1, 0, -1, -1, -1, 0, 1, 0]y1 = [0, 1, 1, 1, 0, -1, -1, -1, 0]def debag():r = 0for x in range(H):for y in range(W):sm = 0for px, py in zip(x1, y1):cx = x+px; cy = y+pyif 0<=cx<H and 0<=cy<W:sm += ans[cx][cy]if r == 0:S = smelse:if sm != S:return Falsereturn Trueif X > 36:print(-1)exit()elif W < 2 or W < 2:c = min(H, 2)*min(W, 2)if X > 9*c:exit()else:print(min(X, 9), X-min(X, 9))else:a, b = X//4, X%4x = []for i in range(4):if b > 0:ex = 1else:ex = 0if i < 2:ans[0][i] = a + exb -= 1else:ans[1][i-2] = a + exfor i in range(3):xx = []for j in range(3):xx.append(ans[i][j])x.append(xx)for i in range(H):for j in range(W):ans[i][j] = x[i%3][j%3]ans[i].pop()print(*ans[i], sep = '')# print(debag())