結果
| 問題 | No.2528 pop_(backfront or not) |
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-04-02 01:00:47 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,032 bytes |
| 記録 | |
| コンパイル時間 | 1,312 ms |
| コンパイル使用メモリ | 220,152 KB |
| 実行使用メモリ | 54,400 KB |
| 最終ジャッジ日時 | 2026-07-04 09:17:04 |
| 合計ジャッジ時間 | 15,485 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 TLE * 2 -- * 2 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
void fast_io() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
int main() {
fast_io();
int n;
cin >> n;
vector<vector<mint>> dp(2 * n + 1, vector<mint>(2 * n + 1, 0));
dp[0][0] = 1;
for (int i = 1; i <= 2 * n; i++) {
for (int j = 1; j <= 2 * n; j++) {
// 両端を取り除く
dp[i][j] += dp[i - 1][j - 1];
// 両端以外から、両方取り除く
dp[i][j] += dp[i - 1][j - 1] * (i - 1) * (j - 1);
// 左側から2つ取り除く
if (i >= 2) {
dp[i][j] += dp[i - 2][j] * (i - 1) * (i - 2) / 2;
}
// 右側から2つ取り除く
if (j >= 2) {
dp[i][j] += dp[i][j - 2] * (j - 1) * (j - 2) / 2;
}
}
}
for (int i = 1; i <= 2 * n + 1; i++) {
cout << dp[i - 1][2 * n + 1 - i].val() << "\n";
}
}
eve__fuyuki