結果

問題 No.1948 足し算するだけのパズルゲーム(1)
ユーザー hashi_pyhashi_py
提出日時 2022-05-20 23:26:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 706 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 25,396 KB
最終ジャッジ日時 2023-10-20 14:22:13
合計ジャッジ時間 5,241 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,112 KB
testcase_01 AC 30 ms
10,108 KB
testcase_02 AC 29 ms
10,108 KB
testcase_03 AC 27 ms
10,108 KB
testcase_04 AC 27 ms
10,108 KB
testcase_05 AC 26 ms
10,108 KB
testcase_06 AC 25 ms
10,108 KB
testcase_07 AC 85 ms
19,824 KB
testcase_08 AC 96 ms
20,320 KB
testcase_09 AC 101 ms
20,800 KB
testcase_10 AC 102 ms
20,800 KB
testcase_11 AC 96 ms
20,756 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