結果

問題 No.2708 Jewel holder
ユーザー nikoro256nikoro256
提出日時 2024-03-31 13:54:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 66,052 KB
最終ジャッジ日時 2024-03-31 13:54:24
合計ジャッジ時間 2,050 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
59,580 KB
testcase_01 AC 42 ms
59,580 KB
testcase_02 AC 44 ms
59,580 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 40 ms
53,460 KB
testcase_07 AC 49 ms
61,860 KB
testcase_08 AC 56 ms
63,948 KB
testcase_09 AC 51 ms
63,952 KB
testcase_10 AC 53 ms
63,956 KB
testcase_11 AC 53 ms
63,952 KB
testcase_12 AC 43 ms
59,580 KB
testcase_13 AC 55 ms
63,956 KB
testcase_14 AC 52 ms
63,932 KB
testcase_15 AC 55 ms
63,956 KB
testcase_16 AC 49 ms
61,872 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
A=[]
for _ in range(H):
    A.append(input())
lim=120
dp=[[[0]*(lim) for _ in range(W)]  for _ in range(H)]
dp[0][0][0]=1
for i in range(H):
    for j in range(W):
        for k in range(lim-1):
            if A[i][j]=="o":
                if i!=H-1:
                    dp[i+1][j][k+1]+=dp[i][j][k]
                if j!=W-1:
                    dp[i][j+1][k+1]+=dp[i][j][k]
            elif A[i][j]=='#':
                continue
            else:
                if k==0:
                    continue
                if i!=H-1:
                    dp[i+1][j][k-1]+=dp[i][j][k]
                if j!=W-1:
                    dp[i][j+1][k-1]+=dp[i][j][k]
if A[-1][-1]=='o':
    dp[-1][-1]=[0]+dp[-1][-1]
else:
    dp[-1][-1]=dp[-1][-1][1:]
print(sum(dp[-1][-1][1:]))
0