結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー convexineqconvexineq
提出日時 2021-02-19 22:18:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 3,153 ms
コード長 1,008 bytes
コンパイル時間 1,497 ms
コンパイル使用メモリ 86,580 KB
実行使用メモリ 80,128 KB
最終ジャッジ日時 2023-10-15 02:30:20
合計ジャッジ時間 28,198 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,056 KB
testcase_01 AC 69 ms
71,220 KB
testcase_02 AC 69 ms
71,148 KB
testcase_03 AC 71 ms
70,964 KB
testcase_04 AC 68 ms
70,888 KB
testcase_05 AC 67 ms
71,132 KB
testcase_06 AC 113 ms
79,544 KB
testcase_07 AC 70 ms
71,192 KB
testcase_08 AC 93 ms
79,484 KB
testcase_09 AC 96 ms
79,844 KB
testcase_10 AC 71 ms
71,200 KB
testcase_11 AC 92 ms
79,432 KB
testcase_12 AC 72 ms
71,112 KB
testcase_13 AC 95 ms
79,320 KB
testcase_14 AC 91 ms
79,324 KB
testcase_15 AC 71 ms
71,064 KB
testcase_16 AC 103 ms
80,128 KB
testcase_17 AC 102 ms
79,616 KB
testcase_18 AC 103 ms
79,792 KB
testcase_19 AC 98 ms
79,888 KB
testcase_20 AC 71 ms
71,060 KB
testcase_21 AC 94 ms
79,588 KB
testcase_22 AC 96 ms
79,732 KB
testcase_23 AC 71 ms
71,120 KB
testcase_24 AC 94 ms
79,328 KB
testcase_25 AC 71 ms
71,308 KB
testcase_26 AC 96 ms
79,956 KB
testcase_27 AC 97 ms
79,720 KB
testcase_28 AC 70 ms
71,152 KB
testcase_29 AC 88 ms
79,532 KB
testcase_30 AC 73 ms
71,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d = {0:1,1:0,2:-1}
w,h,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