結果
問題 | No.1398 調和の魔法陣 (構築) |
ユーザー | 👑 SPD_9X2 |
提出日時 | 2021-02-19 22:34:27 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,311 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,608 KB |
実行使用メモリ | 81,464 KB |
最終ジャッジ日時 | 2024-09-16 20:52:15 |
合計ジャッジ時間 | 46,709 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
52,644 KB |
testcase_01 | AC | 38 ms
52,752 KB |
testcase_02 | AC | 46 ms
61,284 KB |
testcase_03 | AC | 40 ms
54,044 KB |
testcase_04 | AC | 40 ms
52,996 KB |
testcase_05 | AC | 39 ms
54,088 KB |
testcase_06 | AC | 632 ms
80,548 KB |
testcase_07 | AC | 680 ms
79,960 KB |
testcase_08 | AC | 647 ms
80,408 KB |
testcase_09 | WA | - |
testcase_10 | AC | 692 ms
80,548 KB |
testcase_11 | AC | 1,101 ms
81,464 KB |
testcase_12 | AC | 686 ms
80,460 KB |
testcase_13 | AC | 865 ms
79,956 KB |
testcase_14 | AC | 574 ms
80,232 KB |
testcase_15 | AC | 2,689 ms
80,720 KB |
testcase_16 | AC | 223 ms
79,180 KB |
testcase_17 | AC | 580 ms
80,492 KB |
testcase_18 | AC | 379 ms
79,948 KB |
testcase_19 | AC | 587 ms
80,492 KB |
testcase_20 | AC | 481 ms
79,412 KB |
testcase_21 | AC | 219 ms
79,432 KB |
testcase_22 | WA | - |
testcase_23 | AC | 2,671 ms
80,740 KB |
testcase_24 | AC | 699 ms
80,200 KB |
testcase_25 | AC | 639 ms
80,556 KB |
testcase_26 | AC | 219 ms
79,308 KB |
testcase_27 | WA | - |
testcase_28 | AC | 784 ms
80,804 KB |
testcase_29 | AC | 224 ms
79,172 KB |
testcase_30 | AC | 646 ms
80,032 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 ("".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 cnt = 0 for D in range(10): for C in range(10): for B in range(10): for A 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) cnt += 1 if cnt >= 30: print (-1) sys.exit() print (-1)