結果

問題 No.2708 Jewel holder
ユーザー rlangevinrlangevin
提出日時 2024-04-01 21:41:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 63,960 KB
最終ジャッジ日時 2024-04-01 21:41:12
合計ジャッジ時間 1,893 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 43 ms
62,116 KB
testcase_08 AC 46 ms
62,232 KB
testcase_09 AC 46 ms
62,244 KB
testcase_10 AC 45 ms
62,248 KB
testcase_11 AC 50 ms
62,232 KB
testcase_12 AC 38 ms
57,788 KB
testcase_13 AC 45 ms
62,248 KB
testcase_14 AC 45 ms
62,248 KB
testcase_15 AC 46 ms
62,232 KB
testcase_16 AC 46 ms
62,244 KB
testcase_17 AC 47 ms
62,248 KB
testcase_18 AC 50 ms
62,236 KB
testcase_19 AC 50 ms
63,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
M = 105
A = []
for i in range(H):
    A.append(list(input()))

dp = [[[0] * M for _ in range(W)] for _ in range(H)]
dp[0][0][1] = 1
for i in range(H):
    for j in range(W):
        if i == j == 0:
            continue
        if A[i][j] == "#":
            continue
        for m in range(M - 1):
            if i:
                if A[i][j] == "o" and m:
                    dp[i][j][m] += dp[i - 1][j][m - 1]
                if A[i][j] == "x":
                    dp[i][j][m] += dp[i - 1][j][m + 1]
            if j:
                if A[i][j] == "o" and m:
                    dp[i][j][m] += dp[i][j - 1][m - 1]
                if A[i][j] == "x":
                    dp[i][j][m] += dp[i][j - 1][m + 1]
                    
print(sum(dp[-1][-1]))
0