結果

問題 No.2430 Damage Zone
ユーザー ShirotsumeShirotsume
提出日時 2023-08-18 21:19:39
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,077 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 86,548 KB
実行使用メモリ 91,664 KB
最終ジャッジ日時 2023-08-18 21:20:23
合計ジャッジ時間 7,176 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 209 ms
90,908 KB
testcase_01 AC 171 ms
87,232 KB
testcase_02 AC 199 ms
91,448 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 111 ms
74,752 KB
testcase_09 AC 114 ms
74,608 KB
testcase_10 AC 112 ms
74,592 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 205 ms
91,200 KB
testcase_15 AC 243 ms
91,664 KB
testcase_16 AC 220 ms
91,468 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 131 ms
79,548 KB
testcase_23 AC 137 ms
82,216 KB
testcase_24 AC 138 ms
82,236 KB
testcase_25 AC 167 ms
86,816 KB
testcase_26 AC 167 ms
88,768 KB
testcase_27 AC 152 ms
85,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

h, w, k = mi()

s = [input() for _ in range(h)]

dp = [[[0] * (k + 1) for _ in range(h + 1)] for _ in range(w + 1)]

dp[0][0][k] = 1

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            continue
        if s[i][j] == 'o':
            for x in range(1, k + 1):
                if i - 1 >= 0:
                    dp[i][j][x - 1] += dp[i - 1][j][x]
                if j - 1 >= 0:
                    dp[i][j][x - 1] += dp[i][j - 1][x]
                dp[i][j][x - 1] %= mod
        else:
            for x in range(k + 1):
                if i - 1 >= 0:
                    dp[i][j][x] += dp[i - 1][j][x]
                if j - 1 >= 0:
                    dp[i][j][x] += dp[i][j - 1][x]
                dp[i][j][x] %= mod
ans = 0
for i in range(1, k + 1):
    ans += dp[h - 1][w - 1][i]
print(ans % mod)
0