結果

問題 No.1948 足し算するだけのパズルゲーム(1)
ユーザー hashi_pyhashi_py
提出日時 2022-05-20 23:06:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 702 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 139,596 KB
最終ジャッジ日時 2023-10-20 14:00:07
合計ジャッジ時間 5,049 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,616 KB
testcase_01 AC 35 ms
53,592 KB
testcase_02 AC 35 ms
53,592 KB
testcase_03 AC 35 ms
53,596 KB
testcase_04 AC 35 ms
53,592 KB
testcase_05 AC 35 ms
53,596 KB
testcase_06 AC 36 ms
53,596 KB
testcase_07 AC 70 ms
77,296 KB
testcase_08 AC 79 ms
76,244 KB
testcase_09 AC 78 ms
76,896 KB
testcase_10 AC 81 ms
76,896 KB
testcase_11 AC 80 ms
76,888 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0