結果

問題 No.2430 Damage Zone
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 21:42:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 92,544 KB
最終ジャッジ日時 2024-05-06 03:38:49
合計ジャッジ時間 3,827 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
85,376 KB
testcase_01 AC 82 ms
81,536 KB
testcase_02 AC 119 ms
91,776 KB
testcase_03 AC 50 ms
61,952 KB
testcase_04 AC 53 ms
63,616 KB
testcase_05 AC 54 ms
64,384 KB
testcase_06 AC 36 ms
51,584 KB
testcase_07 AC 36 ms
51,968 KB
testcase_08 AC 36 ms
52,224 KB
testcase_09 AC 37 ms
51,968 KB
testcase_10 AC 35 ms
51,840 KB
testcase_11 AC 60 ms
67,456 KB
testcase_12 AC 60 ms
67,456 KB
testcase_13 AC 40 ms
57,856 KB
testcase_14 AC 121 ms
92,544 KB
testcase_15 AC 119 ms
92,544 KB
testcase_16 AC 118 ms
92,544 KB
testcase_17 AC 86 ms
79,360 KB
testcase_18 AC 67 ms
72,448 KB
testcase_19 AC 40 ms
57,856 KB
testcase_20 AC 90 ms
82,560 KB
testcase_21 AC 61 ms
67,968 KB
testcase_22 AC 61 ms
68,096 KB
testcase_23 AC 61 ms
68,096 KB
testcase_24 AC 58 ms
66,944 KB
testcase_25 AC 88 ms
81,280 KB
testcase_26 AC 93 ms
83,584 KB
testcase_27 AC 91 ms
80,384 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