結果

問題 No.2430 Damage Zone
ユーザー hato336hato336
提出日時 2023-08-18 21:27:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 1,075 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 94,976 KB
最終ジャッジ日時 2024-05-06 03:18:22
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 199 ms
86,132 KB
testcase_01 AC 162 ms
83,020 KB
testcase_02 AC 271 ms
93,744 KB
testcase_03 AC 60 ms
67,456 KB
testcase_04 AC 62 ms
67,968 KB
testcase_05 AC 63 ms
68,864 KB
testcase_06 AC 37 ms
52,352 KB
testcase_07 AC 36 ms
52,096 KB
testcase_08 AC 37 ms
51,840 KB
testcase_09 AC 37 ms
51,968 KB
testcase_10 AC 37 ms
51,968 KB
testcase_11 AC 90 ms
77,112 KB
testcase_12 AC 85 ms
77,104 KB
testcase_13 AC 48 ms
61,952 KB
testcase_14 AC 299 ms
94,908 KB
testcase_15 AC 319 ms
94,976 KB
testcase_16 AC 304 ms
94,976 KB
testcase_17 AC 135 ms
80,304 KB
testcase_18 AC 88 ms
77,312 KB
testcase_19 AC 51 ms
64,512 KB
testcase_20 AC 176 ms
84,096 KB
testcase_21 AC 87 ms
76,668 KB
testcase_22 AC 68 ms
71,424 KB
testcase_23 AC 68 ms
71,168 KB
testcase_24 AC 68 ms
71,040 KB
testcase_25 AC 132 ms
81,904 KB
testcase_26 AC 159 ms
84,784 KB
testcase_27 AC 116 ms
80,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w,k = map(int,input().split())
grid = []
for i in range(h):
    grid.append(list(input()))
mod = 998244353
dist = [[[0 for i in range(w)] for j in range(h) ] for wfo2bor3 in range(k+1)]
dist[k][0][0] = 1

for i in range(h):
    for j in range(w):
        for health in range(k+1):
            if i != h-1:
                if grid[i+1][j] == '.':
                    dist[health][i+1][j] += dist[health][i][j]
                    dist[health][i+1][j] %= mod
                if grid[i+1][j] == 'o' and health >= 2:
                    dist[health-1][i+1][j] += dist[health][i][j]
                    dist[health-1][i+1][j] %= mod
            
            if j != w-1:
                if grid[i][j+1] == '.':
                    dist[health][i][j+1] += dist[health][i][j]
                    dist[health][i][j+1] %= mod
                if grid[i][j+1] == 'o' and health >= 2:
                    dist[health-1][i][j+1] += dist[health][i][j]
                    dist[health-1][i][j+1] %= mod
ans = 0
for i in range(1,k+1):
    ans += dist[i][h-1][w-1]
    ans %= mod
print(ans)
0