結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー ayaoniayaoni
提出日時 2021-02-19 22:04:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,003 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 71,656 KB
最終ジャッジ日時 2023-10-15 01:47:21
合計ジャッジ時間 27,413 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,176 KB
testcase_01 AC 71 ms
71,168 KB
testcase_02 AC 70 ms
71,024 KB
testcase_03 AC 70 ms
71,084 KB
testcase_04 AC 71 ms
71,176 KB
testcase_05 AC 70 ms
71,204 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 75 ms
71,044 KB
testcase_17 AC 74 ms
70,996 KB
testcase_18 AC 73 ms
71,340 KB
testcase_19 AC 75 ms
71,224 KB
testcase_20 AC 71 ms
71,112 KB
testcase_21 AC 72 ms
71,024 KB
testcase_22 AC 72 ms
71,336 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 71 ms
70,984 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 74 ms
71,244 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


W,H,X = MI()

if W >= 2 and H >= 2:
    if X > 36:
        print(-1)
        exit()
    A = []
    for i in range(4):
        for j in range(10):
            if 0 <= X-j <= 9*(3-i):
                X -= j
                A.append(j)
                break
    a0 = '{}{}0'.format(A[0],A[1])
    a1 = '{}{}0'.format(A[2],A[3])
    ans0 = a0*(W//3)
    ans1 = a1*(W//3)
    if W % 3 != 0:
        ans0 += str(A[0])
        ans1 += str(A[2])
    if W % 3 == 2:
        ans0 += str(A[1])
        ans1 += str(A[3])
    ans2 = '0'*W
    for i in range(H):
        if i % 3 == 0:
            print(ans0)
        elif i % 3 == 1:
            print(ans1)
        else:
            print(ans2)
elif H == 1 and W >= 2:
    if X > 18:
        print(-1)
        exit()
    A = []
    for i in range(2):
        for j in range(10):
            if 0 <= X-j <= 9*(1-i):
                X -= j
                A.append(j)
                break
    a0 = '{}{}0'.format(A[0],A[1])
    ans0 = a0*(W//3)
    if W % 3 != 0:
        ans0 += str(A[0])
    if W % 3 == 2:
        ans0 += str(A[1])
    print(ans0)
elif H >= 2 and W == 1:
    if X > 18:
        print(-1)
        exit()
    A = []
    for i in range(2):
        for j in range(10):
            if 0 <= X-j <= 9*(1-i):
                X -= j
                A.append(j)
                break
    for i in range(H):
        if i % 3 == 0:
            print(A[0])
        elif i % 3 == 1:
            print(A[1])
        else:
            print(0)
else:
    if X > 9:
        print(-1)
        exit()
    print(X)
0