結果
| 問題 |
No.2430 Damage Zone
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-18 21:27:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 297 ms / 2,000 ms |
| コード長 | 1,075 bytes |
| コンパイル時間 | 332 ms |
| コンパイル使用メモリ | 81,664 KB |
| 実行使用メモリ | 95,104 KB |
| 最終ジャッジ日時 | 2024-11-28 05:41:31 |
| 合計ジャッジ時間 | 4,784 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
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)