結果
問題 | No.1949 足し算するだけのパズルゲーム(2) |
ユーザー | norioc |
提出日時 | 2022-05-20 22:40:22 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 767 bytes |
コンパイル時間 | 1,720 ms |
コンパイル使用メモリ | 81,548 KB |
実行使用メモリ | 136,704 KB |
最終ジャッジ日時 | 2023-10-20 13:28:23 |
合計ジャッジ時間 | 13,633 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
53,468 KB |
testcase_01 | AC | 41 ms
53,468 KB |
testcase_02 | AC | 41 ms
53,468 KB |
testcase_03 | AC | 42 ms
53,468 KB |
testcase_04 | AC | 40 ms
53,468 KB |
testcase_05 | AC | 41 ms
53,468 KB |
testcase_06 | AC | 40 ms
53,468 KB |
testcase_07 | AC | 741 ms
119,248 KB |
testcase_08 | AC | 84 ms
76,216 KB |
testcase_09 | AC | 767 ms
119,256 KB |
testcase_10 | AC | 814 ms
119,844 KB |
testcase_11 | AC | 872 ms
121,604 KB |
testcase_12 | AC | 855 ms
119,976 KB |
testcase_13 | WA | - |
testcase_14 | AC | 900 ms
136,704 KB |
testcase_15 | AC | 912 ms
136,704 KB |
testcase_16 | AC | 73 ms
76,700 KB |
testcase_17 | AC | 1,559 ms
134,152 KB |
testcase_18 | AC | 73 ms
76,704 KB |
testcase_19 | AC | 40 ms
53,468 KB |
testcase_20 | AC | 41 ms
53,468 KB |
testcase_21 | WA | - |
testcase_22 | AC | 1,122 ms
128,360 KB |
testcase_23 | AC | 41 ms
53,468 KB |
testcase_24 | AC | 471 ms
97,304 KB |
testcase_25 | AC | 752 ms
119,352 KB |
ソースコード
from heapq import heappush, heappop H, W, Y, X = map(int, input().split()) A = [] for _ in range(H): A.append(list(map(int, input().split()))) def delta(row, col): for dr, dc in [(-1, 0), (1, 0), (0, -1), (0, 1)]: r = row + dr c = col + dc if not (0 <= r < H and 0 <= c < W): continue yield r, c row = Y-1 col = X-1 atk = A[row][col] q = [] used = {(row, col)} for r, c in delta(row, col): heappush(q, (A[r][c], r, c)) used.add((r, c)) while q: a, row, col = heappop(q) if a >= atk: break atk += a for r, c in delta(row, col): if (r, c) in used: continue heappush(q, (A[r][c], r, c)) used.add((r, c)) if len(used) == H * W: print('Yes') else: print('No')