結果

問題 No.1948 足し算するだけのパズルゲーム(1)
コンテスト
ユーザー flippergo
提出日時 2026-03-22 09:47:14
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
MLE  
実行時間 -
コード長 590 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 310 ms
コンパイル使用メモリ 84,832 KB
実行使用メモリ 1,394,716 KB
最終ジャッジ日時 2026-03-22 09:48:02
合計ジャッジ時間 44,277 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 TLE * 7 MLE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import deque
H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
que = deque([])
que.append((0,0,A[0][0],0))
ans = "No"
while que:
    i,j,a,s = que.popleft()
    if i==H-1 and j==W-1 and a>A[H-1][W-1]:
        ans = "Yes"
        break
    if i+1<H and A[i+1][j]<a:
        que.append((i+1,j,a+A[i+1][j],s))
    elif i+1<H and A[i+1][j]>=a and s==0:
        que.append((i+1,j,a,1))
    if j+1<W and A[i][j+1]<a:
        que.append((i,j+1,a+A[i][j+1],s))
    elif j+1<W and A[i][j+1]>=a and s==0:
        que.append((i,j+1,a,1))
print(ans)
0