結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー takelifetime
提出日時 2021-02-19 22:22:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,073 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-09-16 20:22:48
合計ジャッジ時間 26,464 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

w, h, x = map(int, input().split())
if x > 36:
    print(-1)

elif w > 1 and h > 1:
    if w % 3 == 2 and h % 3 == 2:
        line1 = str(x % 9) + str(int(x > 9) * 9) + "0"
        line1 *= w // 3 + 1
        line1 = line1[:w]
        line2 = str(int(x > 18) * 9) + str(int(x > 27) * 9) + "0"
        line2 *= w // 3 + 1
        line2 = line2[:w]
        line3 = "0" * w
        lines = [line1, line2, line3]
        for l in range(h):
            print(lines[l % 3])
    else:
        print(-1)

elif w == h == 1:
    if x > 9:
        print(-1)
    else:
        print(x)
elif w == 1:
    if x > 18:
        print(-1)
    else:
        if h % 3 == 2:
            lines = [str(x % 9), str(int(x > 9) * 9), 0]
            for l in range(h):
                print(lines[l % 3])
        else:
            print(-1)
elif h == 1:
    if x > 18:
        print(-1)
    else:
        if w % 3 == 2:
            line1 = str(x % 9) + str(int(x > 9) * 9) + "0"
            line1 *= w // 3 + 1
            line1 = line1[:w]
            print(line1)
        else:
            print(-1)
0