結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー wolgnikwolgnik
提出日時 2021-02-19 21:49:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 749 bytes
コンパイル時間 1,305 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 80,668 KB
最終ジャッジ日時 2023-10-15 00:54:45
合計ジャッジ時間 28,312 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 74 ms
70,908 KB
testcase_03 AC 74 ms
71,016 KB
testcase_04 AC 72 ms
71,012 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 75 ms
71,012 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 73 ms
71,088 KB
testcase_11 WA -
testcase_12 AC 73 ms
71,080 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 72 ms
71,084 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 73 ms
70,908 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 75 ms
71,072 KB
testcase_24 WA -
testcase_25 AC 73 ms
70,912 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 74 ms
71,252 KB
testcase_29 WA -
testcase_30 AC 73 ms
71,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
W, H, X = map(int, input().split())
res = [[0] * W for _ in range(H)]
if H >= 3 and W >= 3:
  if X > 9:
    print(-1)
    exit(0)
  for i in range(H):
    for j in range(W):
      if i % 3 == 1 and j % 3 == 1: res[i][j] = X
elif H <= 2:
  if H == 1 and X > 9:
    print(-1)
    exit(0)
  if X > 18:
    print(-1)
    exit(0)
  u = min(9, X)
  d = max(0, X - u)
  for j in range(W):
    if j % 3 == 0:
      res[0][j] = u
      if H > 1: res[1][j] = d
elif W <= 2:
  if W == 1 and W > 9:
    print(-1)
    exit(0)
  if X > 18:
    print(-1)
    exit(0)
  u = min(9, X)
  d = max(0, X - u)
  for i in range(H):
    if i % 3 == 0:
      res[i][0] = u
      if W > 1: res[i][1] = d
for i in range(H): print(*res[i])
0