結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー convexineqconvexineq
提出日時 2021-02-19 22:13:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,008 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 80,228 KB
最終ジャッジ日時 2023-10-15 02:09:48
合計ジャッジ時間 29,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,328 KB
testcase_01 WA -
testcase_02 AC 78 ms
71,388 KB
testcase_03 AC 79 ms
71,456 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 104 ms
79,972 KB
testcase_07 AC 79 ms
71,432 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 80 ms
71,616 KB
testcase_11 WA -
testcase_12 AC 77 ms
71,172 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 79 ms
71,396 KB
testcase_16 AC 115 ms
80,228 KB
testcase_17 AC 113 ms
79,972 KB
testcase_18 AC 114 ms
80,000 KB
testcase_19 AC 112 ms
80,004 KB
testcase_20 AC 79 ms
71,396 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 77 ms
71,348 KB
testcase_24 WA -
testcase_25 AC 80 ms
71,620 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 78 ms
71,336 KB
testcase_29 AC 101 ms
79,808 KB
testcase_30 AC 77 ms
71,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d = {0:1,1:0,2:-1}
h,w,x = map(int,input().split())
ans = [[0]*w for _ in range(h)]
s = (2 if h%3==2 else 1)*(2 if w%3==2 else 1)
if s*9 < x:
    print(-1)
    exit()
a = x//s
if s==1:
    for i in range(h):
        if i%3 != d[h%3]: continue
        for j in range(w):
            if j%3 != d[w%3]: continue
            ans[i][j] = a
if s==2:
    V = x%2
    if h%3==2:
        for i in range(h):
            if i%3 == 2: continue
            for j in range(w):
                if j%3 != d[w%3]: continue
                ans[i][j] = a + (i%3==0)*V
    else:
        for i in range(h):
            if i%3 != d[h%3]: continue
            for j in range(w):
                if j%3 == 2: continue
                ans[i][j] = a + (j%3==0)*V

if s==4:
    d = {(0,0):0,(0,1):(x%4>=3),(1,0):(x%4>=2),(1,1):(x%4>=1)}
    for i in range(h):
        if i%3 == 2: continue
        for j in range(w):
            if j%3 == 2: continue
            ans[i][j] = a + d[i%3,j%3]

for i in ans:
    print("".join(map(str,i)))
0