結果
問題 |
No.3213 depth max K
|
ユーザー |
|
提出日時 | 2025-07-25 22:28:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 212 ms / 2,000 ms |
コード長 | 624 bytes |
コンパイル時間 | 4,049 ms |
コンパイル使用メモリ | 253,308 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-25 22:28:45 |
合計ジャッジ時間 | 6,279 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using mint = atcoder::modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; auto f = [&](int mx){ vector<mint> dp(mx + 1); dp[0] = 1; for(int i = 0; i < 2 * n; i++){ vector<mint> ndp(mx + 1); for(int j = 0; j <= mx; j++){ if(j >= 1) ndp[j - 1] += dp[j]; if(j < mx) ndp[j + 1] += dp[j]; } swap(ndp, dp); } return dp[0]; }; cout << (f(k) - f(k - 1)).val() << '\n'; }