結果

問題 No.1492 01文字列と転倒
ユーザー rtyu
提出日時 2021-10-19 14:08:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 67,840 KB
実行使用メモリ 19,736 KB
最終ジャッジ日時 2024-09-20 06:21:12
合計ジャッジ時間 10,453 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

long long d[2][109][10009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; long long md; cin >> n >> md;
	d[0][0][0] = 1;
	for (int i = 1; i <= 2 * n; i++)
		for (int j = 0; j <= i / 2; j++)
			for (int k = 0; k <= n * n; k++) {
				if (k >= j) d[(i & 1)][j][k] = d[!(i & 1)][j][k - j];
				else d[(i & 1)][j][k] = 0;
				if (j) d[(i & 1)][j][k] = (d[(i & 1)][j][k] + d[!(i & 1)][j - 1][k]) % md;
			}
	for (int i = 0; i <= n * n; i++)
		cout << d[n & 1][n][i] << '\n';
	return 0;
}
0