結果
| 問題 | 
                            No.1948 足し算するだけのパズルゲーム(1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hashi_py
                         | 
                    
| 提出日時 | 2022-05-20 23:06:55 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 702 bytes | 
| コンパイル時間 | 154 ms | 
| コンパイル使用メモリ | 82,408 KB | 
| 実行使用メモリ | 151,208 KB | 
| 最終ジャッジ日時 | 2024-09-20 09:30:12 | 
| 合計ジャッジ時間 | 4,838 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 12 TLE * 1 -- * 14 | 
ソースコード
h,w = map(int,input().split())
G = [list(map(int,input().split()))for _ in range(h)]
from sys import setrecursionlimit
setrecursionlimit(300000)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
ret = []
def dfs(power,H,W,continued):
    # print(power,H,W,continued)
    if(H==h-1 and W==w-1):
        if(power>G[-1][-1]):
            print("Yes")
            exit()
        else:
            return
    for a,b in ((0,1),(1,0)):
        if(0<=H+a<h and 0<=W+b<w):
            if(G[H+a][W+b]<power):
                dfs(power+G[H+a][W+b],H+a,W+b,continued)
            else:
                if(continued==0):
                    dfs(power,H+a,W+b,continued+1)
dfs(G[0][0],0,0,0)
print("No")
            
            
            
        
            
hashi_py