結果

問題 No.1492 01文字列と転倒
ユーザー rtyurtyu
提出日時 2021-10-19 14:08:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 67,108 KB
実行使用メモリ 20,628 KB
最終ジャッジ日時 2023-10-20 10:46:32
合計ジャッジ時間 11,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,676 KB
testcase_01 AC 2 ms
7,684 KB
testcase_02 AC 1,162 ms
20,628 KB
testcase_03 AC 1,071 ms
20,628 KB
testcase_04 AC 985 ms
20,444 KB
testcase_05 AC 831 ms
19,928 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1,160 ms
20,628 KB
testcase_09 WA -
testcase_10 AC 3 ms
7,676 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 5 ms
9,860 KB
testcase_16 AC 19 ms
10,208 KB
testcase_17 AC 832 ms
19,928 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 701 ms
19,444 KB
testcase_22 AC 19 ms
10,208 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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