結果

問題 No.2430 Damage Zone
ユーザー tassei903tassei903
提出日時 2023-08-15 05:53:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 1,353 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 94,976 KB
最終ジャッジ日時 2024-05-02 17:58:50
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 229 ms
86,580 KB
testcase_01 AC 189 ms
82,560 KB
testcase_02 AC 293 ms
93,696 KB
testcase_03 AC 72 ms
68,480 KB
testcase_04 AC 76 ms
68,992 KB
testcase_05 AC 85 ms
72,704 KB
testcase_06 AC 41 ms
52,224 KB
testcase_07 AC 42 ms
51,968 KB
testcase_08 AC 42 ms
52,352 KB
testcase_09 AC 42 ms
52,224 KB
testcase_10 AC 41 ms
52,352 KB
testcase_11 AC 98 ms
77,184 KB
testcase_12 AC 98 ms
77,056 KB
testcase_13 AC 56 ms
62,080 KB
testcase_14 AC 285 ms
94,848 KB
testcase_15 AC 290 ms
94,848 KB
testcase_16 AC 298 ms
94,976 KB
testcase_17 AC 164 ms
80,776 KB
testcase_18 AC 123 ms
78,052 KB
testcase_19 AC 68 ms
67,200 KB
testcase_20 AC 192 ms
84,096 KB
testcase_21 AC 111 ms
76,556 KB
testcase_22 AC 75 ms
68,608 KB
testcase_23 AC 75 ms
68,736 KB
testcase_24 AC 75 ms
68,480 KB
testcase_25 AC 135 ms
81,408 KB
testcase_26 AC 154 ms
84,480 KB
testcase_27 AC 125 ms
80,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
h, w, k = na()
mod = 998244353
dp = [[[0 for j in range(w)]for i in range(h)]for t in range(k)]
dp[0][0][0] = 1
s = [input() for i in range(h)]
for t in range(k):
    for i in range(h):
        for j in range(w):
            if i < h - 1:
                ni = i + 1
                nj = j
                nt = t
                if s[ni][nj] == "o":
                    nt += 1
                if s[ni][nj] == "#":
                    nt += 100000000
                if nt < k:
                    dp[nt][ni][nj] += dp[t][i][j]
                    dp[nt][ni][nj] %= mod
            if j < w-1:
                ni = i 
                nj = j+1
                nt = t
                if s[ni][nj] == "o":
                    nt += 1
                if s[ni][nj] == "#":
                    nt += 100000000
                if nt < k:
                    dp[nt][ni][nj] += dp[t][i][j]
                    dp[nt][ni][nj] %= mod

ans = 0
for i in range(k):
    ans += dp[i][-1][-1]
    ans %= mod
print(ans)
0