結果

問題 No.2430 Damage Zone
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 21:42:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 94,060 KB
最終ジャッジ日時 2023-08-18 21:43:00
合計ジャッジ時間 4,805 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
86,536 KB
testcase_01 AC 111 ms
82,900 KB
testcase_02 AC 156 ms
92,684 KB
testcase_03 AC 86 ms
76,652 KB
testcase_04 AC 118 ms
76,732 KB
testcase_05 AC 85 ms
76,776 KB
testcase_06 AC 73 ms
71,340 KB
testcase_07 AC 73 ms
71,260 KB
testcase_08 AC 75 ms
71,340 KB
testcase_09 AC 73 ms
71,116 KB
testcase_10 AC 74 ms
71,112 KB
testcase_11 AC 94 ms
76,728 KB
testcase_12 AC 94 ms
76,616 KB
testcase_13 AC 79 ms
75,716 KB
testcase_14 AC 155 ms
94,008 KB
testcase_15 AC 187 ms
93,760 KB
testcase_16 AC 152 ms
94,060 KB
testcase_17 AC 118 ms
80,632 KB
testcase_18 AC 104 ms
78,240 KB
testcase_19 AC 77 ms
75,684 KB
testcase_20 AC 124 ms
83,936 KB
testcase_21 AC 98 ms
76,896 KB
testcase_22 AC 97 ms
76,536 KB
testcase_23 AC 97 ms
76,756 KB
testcase_24 AC 94 ms
76,876 KB
testcase_25 AC 122 ms
82,564 KB
testcase_26 AC 124 ms
85,284 KB
testcase_27 AC 122 ms
81,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""


"""

import sys
from sys import stdin

H,W,K = map(int,stdin.readline().split())

S = [stdin.readline()[:-1] for i in range(H)]

dp = [[[0] * K for j in range(W)] for i in range(H)]

dp[0][0][0] = 1
mod = 998244353

for i in range(H):
    for j in range(W):
        for k in range(K):

            if dp[i][j][k] == 0:
                continue

            for nx,ny in ( (i,j+1),(i+1,j) ):

                if nx < H and ny < W and S[nx][ny] != "#":
                    nk = k + (1 if S[nx][ny] == "o" else 0)

                    if nk < K:

                        dp[nx][ny][nk] += dp[i][j][k]
                        dp[nx][ny][nk] %= mod

ans = sum(dp[-1][-1]) % mod

print (ans)
0