結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー | marroncastle |
提出日時 | 2021-02-24 02:29:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 69 ms / 3,153 ms |
コード長 | 1,722 bytes |
コンパイル時間 | 214 ms |
コンパイル使用メモリ | 82,060 KB |
実行使用メモリ | 79,096 KB |
最終ジャッジ日時 | 2024-09-22 21:38:54 |
合計ジャッジ時間 | 28,088 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
52,352 KB |
testcase_01 | AC | 39 ms
52,608 KB |
testcase_02 | AC | 38 ms
52,608 KB |
testcase_03 | AC | 40 ms
52,736 KB |
testcase_04 | AC | 37 ms
52,992 KB |
testcase_05 | AC | 38 ms
52,608 KB |
testcase_06 | AC | 62 ms
78,444 KB |
testcase_07 | AC | 39 ms
55,680 KB |
testcase_08 | AC | 64 ms
78,592 KB |
testcase_09 | AC | 66 ms
78,680 KB |
testcase_10 | AC | 42 ms
55,296 KB |
testcase_11 | AC | 63 ms
78,728 KB |
testcase_12 | AC | 38 ms
55,680 KB |
testcase_13 | AC | 67 ms
78,720 KB |
testcase_14 | AC | 64 ms
78,336 KB |
testcase_15 | AC | 38 ms
55,552 KB |
testcase_16 | AC | 68 ms
78,720 KB |
testcase_17 | AC | 68 ms
78,692 KB |
testcase_18 | AC | 69 ms
79,096 KB |
testcase_19 | AC | 66 ms
78,716 KB |
testcase_20 | AC | 38 ms
55,424 KB |
testcase_21 | AC | 66 ms
78,592 KB |
testcase_22 | AC | 67 ms
78,580 KB |
testcase_23 | AC | 39 ms
56,556 KB |
testcase_24 | AC | 65 ms
78,792 KB |
testcase_25 | AC | 38 ms
57,452 KB |
testcase_26 | AC | 64 ms
78,452 KB |
testcase_27 | AC | 65 ms
78,572 KB |
testcase_28 | AC | 38 ms
55,424 KB |
testcase_29 | AC | 63 ms
78,620 KB |
testcase_30 | AC | 39 ms
55,552 KB |
ソースコード
W, H, X = map(int, input().split()) ans = [[0]*W for _ in range(H)] if X>36: print(-1) elif H%3==2 and W%3==2: a = min(9,X) b = min(9,X-a) c = min(9,X-a-b) d = max(0,X-27) for i in range(0,H,3): for j in range(0,W,3): ans[i][j] = a for j in range(1,W,3): ans[i][j] = b for i in range(1,H,3): for j in range(0,W,3): ans[i][j] = c for j in range(1,W,3): ans[i][j] = d for a in ans: print(''.join(map(str,a))) elif H%3==2: if X>18: print(-1) else: a = min(9,X) b = max(0,X-9) if W%3==1: for i in range(0,H,3): for j in range(0,W,3): ans[i][j] = a for i in range(1,H,3): for j in range(0,W,3): ans[i][j] = b else: for i in range(0,H,3): for j in range(1,W,3): ans[i][j] = a for i in range(1,H,3): for j in range(1,W,3): ans[i][j] = b for a in ans: print(''.join(map(str,a))) elif W%3==2: if X>18: print(-1) else: a = min(9,X) b = max(0,X-9) if H%3==1: for i in range(0,H,3): for j in range(0,W,3): ans[i][j] = a for j in range(1,W,3): ans[i][j] = b else: for i in range(1,H,3): for j in range(0,W,3): ans[i][j] = a for j in range(1,W,3): ans[i][j] = b for a in ans: print(''.join(map(str,a))) else: if X>9: print(-1) else: a = X if H%3==1 and W%3==1: for i in range(0,H,3): for j in range(0,W,3): ans[i][j] = a elif H%3==1: for i in range(0,H,3): for j in range(1,W,3): ans[i][j] = a elif W%3==1: for i in range(1,H,3): for j in range(0,W,3): ans[i][j] = a else: for i in range(1,H,3): for j in range(1,W,3): ans[i][j] = a for a in ans: print(''.join(map(str,a)))