結果
問題 | No.2430 Damage Zone |
ユーザー |
|
提出日時 | 2023-08-18 22:05:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 1,000 bytes |
コンパイル時間 | 2,895 ms |
コンパイル使用メモリ | 256,024 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-11-28 07:20:10 |
合計ジャッジ時間 | 3,941 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using namespace atcoder; using mint = modint998244353; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int m, n, h; cin >> m >> n >> h; vector<string> s(m); for (int i = 0; i < m; i++) { cin >> s[i]; } vector dp(m, vector(n, vector<mint>(h + 1))); dp[0][0][h] = 1; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (s[i][j] == '#') { continue; } for (int k = 1; k <= h; k++) { if (i > 0 && (k < h || s[i][j] == '.')) { dp[i][j][k] += dp[i - 1][j][k + (s[i][j] == 'o')]; } if (j > 0 && (k < h || s[i][j] == '.')) { dp[i][j][k] += dp[i][j - 1][k + (s[i][j] == 'o')]; } } } } cout << accumulate(dp[m - 1][n - 1].begin(), dp[m - 1][n - 1].end(), mint(0)).val(); }