結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー | 👑 SPD_9X2 |
提出日時 | 2021-02-19 22:22:19 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,221 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 87,156 KB |
実行使用メモリ | 81,864 KB |
最終ジャッジ日時 | 2023-10-15 02:50:23 |
合計ジャッジ時間 | 39,798 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 81 ms
76,312 KB |
testcase_03 | AC | 75 ms
71,572 KB |
testcase_04 | AC | 76 ms
71,268 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 540 ms
80,948 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 549 ms
80,832 KB |
testcase_11 | WA | - |
testcase_12 | AC | 546 ms
81,028 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 1,039 ms
81,260 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 499 ms
80,108 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 1,044 ms
81,152 KB |
testcase_24 | WA | - |
testcase_25 | AC | 519 ms
80,944 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 520 ms
80,736 KB |
testcase_29 | WA | - |
testcase_30 | AC | 511 ms
80,596 KB |
ソースコード
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 (*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) #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) sys.exit() #print (ans) print (-1)