結果
問題 |
No.2528 pop_(backfront or not)
|
ユーザー |
|
提出日時 | 2023-11-08 17:28:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 115 ms / 2,000 ms |
コード長 | 1,021 bytes |
コンパイル時間 | 4,279 ms |
コンパイル使用メモリ | 253,168 KB |
最終ジャッジ日時 | 2025-02-17 20:08:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> #define SELECTER(_1,_2,_3,SELECT,...) SELECT #define rep1(i,n) for(int i=0;i<(int)n;++i) #define rep2(i,a,n) for(int i=(int)a;i<(int)n;++i) #define rep(...) SELECTER(__VA_ARGS__,rep2,rep1)(__VA_ARGS__) #define RSELECTER(_1, _2, _3, RSELECT, ...) RSELECT using namespace std; using namespace atcoder; using ll = long long; using mint=modint998244353; ostream& operator<<(ostream& out, const mint& a){return out << a.val();} constexpr ll MOD = 998244353; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n;cin>>n; vector dp(n + 1, vector<ll>(2 * n + 1, 0)); dp[0][0] = 1; rep(i, n + 1) rep(j, 2 * n + 1){ if(i && j){ dp[i][j] += dp[i - 1][j - 1]; dp[i][j] += dp[i - 1][j - 1] * (i - 1) * (j - 1); dp[i][j] %= MOD; } if(i > 1) dp[i][j] += dp[i - 2][j] * (i - 1) * (i - 2) / 2; if(j > 1) dp[i][j] += dp[i][j - 2] * (j - 1) * (j - 2) / 2; dp[i][j] %= MOD; } rep(i, 2 * n + 1) cout<<dp[min(i, 2 * n - i)][max(i, 2 * n - i)]<<endl; }