結果

問題 No.2528 pop_(backfront or not)
ユーザー akiaa11akiaa11
提出日時 2023-11-08 17:28:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 1,021 bytes
コンパイル時間 4,934 ms
コンパイル使用メモリ 265,148 KB
実行使用メモリ 66,048 KB
最終ジャッジ日時 2023-11-08 17:28:18
合計ジャッジ時間 6,129 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 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 2 ms
6,676 KB
testcase_06 AC 3 ms
6,676 KB
testcase_07 AC 4 ms
6,676 KB
testcase_08 AC 5 ms
6,676 KB
testcase_09 AC 12 ms
8,064 KB
testcase_10 AC 32 ms
18,688 KB
testcase_11 AC 34 ms
19,968 KB
testcase_12 AC 48 ms
27,392 KB
testcase_13 AC 51 ms
29,824 KB
testcase_14 AC 62 ms
36,096 KB
testcase_15 AC 94 ms
54,272 KB
testcase_16 AC 114 ms
65,920 KB
testcase_17 AC 114 ms
65,920 KB
testcase_18 AC 114 ms
66,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0