結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー | 👑 SPD_9X2 |
提出日時 | 2021-02-19 22:31:30 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,171 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 87,284 KB |
実行使用メモリ | 85,160 KB |
最終ジャッジ日時 | 2023-10-15 03:11:53 |
合計ジャッジ時間 | 31,630 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
75,864 KB |
testcase_01 | AC | 71 ms
71,252 KB |
testcase_02 | AC | 77 ms
76,032 KB |
testcase_03 | AC | 71 ms
71,472 KB |
testcase_04 | AC | 72 ms
71,348 KB |
testcase_05 | AC | 73 ms
71,172 KB |
testcase_06 | AC | 1,283 ms
81,700 KB |
testcase_07 | AC | 2,866 ms
80,684 KB |
testcase_08 | AC | 680 ms
81,500 KB |
testcase_09 | AC | 2,207 ms
80,676 KB |
testcase_10 | AC | 2,058 ms
80,920 KB |
testcase_11 | AC | 682 ms
81,508 KB |
testcase_12 | AC | 2,888 ms
80,680 KB |
testcase_13 | AC | 2,344 ms
81,496 KB |
testcase_14 | TLE | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
import sys def sol(ans): for i in range(H): for j in range(W): now = 0 for x in range(i-1,i+2): for y in range(j-1,j+2): if 0 <= x < H and 0 <= y < W: now += ans[x][y] if now != X: return False for i in ans: print ("".join(map(str,i))) sys.exit() W,H,X = map(int,input().split()) ans = [[0] * W for i in range(H)] # type1 for A in range(10): for i in range(H): for j in range(W): if i % 3 == 1: ans[i][j] = A else: ans[i][j] = 0 sol(ans) for A in range(10): for i in range(H): for j in range(W): if j % 3 == 1: ans[i][j] = A else: ans[i][j] = 0 sol(ans) #type3 for A in range(10): for i in range(H): for j in range(W): if i % 3 == j % 3 == 1: ans[i][j] = A else: ans[i][j] = 0 sol(ans) #type2 for A in range(10): for B in range(10): for i in range(H): for j in range(W): if i % 3 == 2 or j % 3 == 2: ans[i][j] = 0 elif i % 3 == j % 3: ans[i][j] = A else: ans[i][j] = B sol(ans) print ("4",file=sys.stderr) #type4 for A in range(10): for B in range(10): for C in range(10): for D in range(10): if A+B+C+D == X: for i in range(H): for j in range(W): if i % 3 == 2 or j % 3 == 2: ans[i][j] = 0 elif i % 3 == j % 3 == 0: ans[i][j] = A elif i % 3 == 0 and j % 3 == 1: ans[i][j] = B elif i % 3 == 1 and j % 3 == 0: ans[i][j] = C else: ans[i][j] = D sol(ans) print (-1)