結果

問題 No.2708 Jewel holder
ユーザー playerplayer
提出日時 2024-04-04 00:22:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,023 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 70,864 KB
最終ジャッジ日時 2024-04-04 00:22:31
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 38 ms
53,460 KB
testcase_07 AC 47 ms
61,992 KB
testcase_08 AC 50 ms
64,088 KB
testcase_09 AC 50 ms
64,100 KB
testcase_10 AC 49 ms
62,000 KB
testcase_11 AC 53 ms
64,092 KB
testcase_12 AC 42 ms
59,508 KB
testcase_13 AC 53 ms
64,084 KB
testcase_14 AC 50 ms
64,100 KB
testcase_15 AC 56 ms
66,184 KB
testcase_16 AC 48 ms
62,000 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

dp = [[[0 for _ in range(101)] for _ in range(w)] for _ in range(h)]
dp[0][0][1] = 1

for i in range(h):
    for j in range(w):  # start position
        if a[i][j] == "#":
            continue
        for k in range(100):
            if i + 1 < h:
                if a[i + 1][j] == "x":
                    if k > 0:
                        dp[i + 1][j][k - 1] += dp[i][j][k]
                if a[i + 1][j] == "o":
                    dp[i + 1][j][k + 1] += dp[i][j][k]
            if j + 1 < w:
                if a[i][j + 1] == "x":
                    if k > 0:
                        dp[i][j + 1][k - 1] += dp[i][j][k]
                if a[i][j + 1] == "o":
                    dp[i][j + 1][k + 1] += dp[i][j][k]

ans = 0
# print(dp[h - 1][w - 1][0])
for i in range(1, 101):
    ans += dp[h - 1][w - 1][i]

# print(dp[0][1])
# print(dp[1][2])
# print(dp[2][1])
# print(dp[2][2])

# print(dp[0][2])
# print(dp[1][2])
# print(dp[2][1])

print(ans)
0