結果
問題 | No.2528 pop_(backfront or not) |
ユーザー | eve__fuyuki |
提出日時 | 2024-04-02 01:00:47 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,032 bytes |
コンパイル時間 | 2,414 ms |
コンパイル使用メモリ | 208,472 KB |
実行使用メモリ | 215,148 KB |
最終ジャッジ日時 | 2024-04-02 01:01:03 |
合計ジャッジ時間 | 15,615 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
13,480 KB |
testcase_01 | AC | 2 ms
6,676 KB |
testcase_02 | AC | 2 ms
6,676 KB |
testcase_03 | AC | 2 ms
6,676 KB |
testcase_04 | AC | 2 ms
6,676 KB |
testcase_05 | AC | 13 ms
6,676 KB |
testcase_06 | AC | 21 ms
6,676 KB |
testcase_07 | AC | 64 ms
6,676 KB |
testcase_08 | AC | 100 ms
6,676 KB |
testcase_09 | AC | 327 ms
8,064 KB |
testcase_10 | AC | 1,102 ms
18,688 KB |
testcase_11 | AC | 1,172 ms
19,968 KB |
testcase_12 | AC | 1,708 ms
27,392 KB |
testcase_13 | AC | 1,948 ms
29,824 KB |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
ソースコード
#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"; } }