結果
問題 | No.1949 足し算するだけのパズルゲーム(2) |
ユーザー |
|
提出日時 | 2022-06-25 02:54:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 795 bytes |
コンパイル時間 | 644 ms |
コンパイル使用メモリ | 82,348 KB |
実行使用メモリ | 102,024 KB |
最終ジャッジ日時 | 2024-04-26 08:37:17 |
合計ジャッジ時間 | 10,938 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
54,436 KB |
testcase_01 | AC | 34 ms
53,708 KB |
testcase_02 | AC | 37 ms
53,148 KB |
testcase_03 | AC | 38 ms
54,036 KB |
testcase_04 | WA | - |
testcase_05 | AC | 39 ms
53,756 KB |
testcase_06 | WA | - |
testcase_07 | AC | 380 ms
81,132 KB |
testcase_08 | WA | - |
testcase_09 | AC | 398 ms
81,112 KB |
testcase_10 | AC | 402 ms
81,520 KB |
testcase_11 | AC | 464 ms
81,896 KB |
testcase_12 | AC | 460 ms
82,348 KB |
testcase_13 | AC | 449 ms
81,972 KB |
testcase_14 | WA | - |
testcase_15 | AC | 582 ms
100,944 KB |
testcase_16 | WA | - |
testcase_17 | AC | 875 ms
96,880 KB |
testcase_18 | WA | - |
testcase_19 | AC | 36 ms
53,276 KB |
testcase_20 | AC | 37 ms
54,224 KB |
testcase_21 | AC | 36 ms
54,328 KB |
testcase_22 | AC | 615 ms
89,872 KB |
testcase_23 | RE | - |
testcase_24 | AC | 281 ms
81,064 KB |
testcase_25 | AC | 406 ms
81,676 KB |
ソースコード
import sys from heapq import heapify, heappush, heappop input = lambda: sys.stdin.readline().rstrip()\ dx = [-1, 0, 0, 1] dy = [0, -1, 1, 0] # ----------------------- # h, w, x, y = map(int, input().split()) x -= 1 y -= 1 A = [list(map(int, input().split())) for _ in range(h)] hq = [(0, y, x)] now = A[y][x] seen = [[False]*w for _ in range(h)] seen[y][x] = True def is_infield(y, x): return 0 <= y < h and 0 <= x < w killed = 0 while hq: a, vy, vx = heappop(hq) if now < a: print('No') exit() killed += 1 now += a for i in range(4): ny, nx = vy+dy[i], vx+dx[i] if not is_infield(ny, nx): continue if seen[ny][nx]: continue seen[ny][nx] = True heappush(hq, (A[ny][nx], ny, nx)) if killed == h*w: print('Yes') else: print('No')