結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー takelifetimetakelifetime
提出日時 2021-02-19 22:36:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,336 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 8,216 KB
最終ジャッジ日時 2023-10-15 03:23:18
合計ジャッジ時間 26,440 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,216 KB
testcase_01 AC 17 ms
8,072 KB
testcase_02 AC 16 ms
8,212 KB
testcase_03 AC 16 ms
8,120 KB
testcase_04 AC 17 ms
8,168 KB
testcase_05 AC 17 ms
8,124 KB
testcase_06 AC 17 ms
8,052 KB
testcase_07 AC 16 ms
8,128 KB
testcase_08 AC 17 ms
8,060 KB
testcase_09 WA -
testcase_10 AC 16 ms
8,120 KB
testcase_11 WA -
testcase_12 AC 16 ms
8,060 KB
testcase_13 AC 17 ms
8,064 KB
testcase_14 WA -
testcase_15 AC 16 ms
8,116 KB
testcase_16 AC 17 ms
8,060 KB
testcase_17 AC 18 ms
8,216 KB
testcase_18 AC 17 ms
8,100 KB
testcase_19 AC 17 ms
8,116 KB
testcase_20 AC 16 ms
8,048 KB
testcase_21 AC 17 ms
8,160 KB
testcase_22 WA -
testcase_23 AC 16 ms
8,076 KB
testcase_24 WA -
testcase_25 AC 17 ms
8,052 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 17 ms
8,108 KB
testcase_29 AC 16 ms
8,020 KB
testcase_30 AC 16 ms
8,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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