結果
問題 |
No.1949 足し算するだけのパズルゲーム(2)
|
ユーザー |
![]() |
提出日時 | 2022-05-20 23:05:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 997 ms |
コンパイル使用メモリ | 82,324 KB |
実行使用メモリ | 98,524 KB |
最終ジャッジ日時 | 2024-09-20 09:29:13 |
合計ジャッジ時間 | 9,492 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 5 RE * 1 |
ソースコード
#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect from heapq import * import functools mod=998244353 import sys input=sys.stdin.readline h,w,y,x=map(int,input().split()) a=[list(map(int,input().split())) for _ in range(h)] now = a[y-1][x-1] heap = [] dx = [1,-1,0,0] dy = [0,0,1,-1] a[y-1][x-1] = -1 py,px=y-1,x-1 cnt = 1 while cnt < h * w: for i in range(4): ny,nx=dy[i]+py,dx[i]+px if 0 <= ny < h and 0 <= nx < w: if a[ny][nx] != -1: heappush(heap,[a[ny][nx],ny,nx]) a[ny][nx] = -1 mi,px,py = heappop(heap) if now > mi: now += mi cnt += 1 else: print('No') exit() print('Yes')