結果

問題 No.1492 01文字列と転倒
ユーザー Example0911Example0911
提出日時 2021-05-01 17:37:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,515 ms / 4,000 ms
コード長 798 bytes
コンパイル時間 2,529 ms
コンパイル使用メモリ 206,356 KB
実行使用メモリ 19,160 KB
最終ジャッジ日時 2023-08-20 01:15:00
合計ジャッジ時間 37,106 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
18,948 KB
testcase_01 AC 56 ms
18,992 KB
testcase_02 AC 3,515 ms
18,952 KB
testcase_03 AC 3,287 ms
19,024 KB
testcase_04 AC 3,087 ms
18,952 KB
testcase_05 AC 2,741 ms
18,932 KB
testcase_06 AC 2,835 ms
18,852 KB
testcase_07 AC 3,004 ms
18,992 KB
testcase_08 AC 3,467 ms
18,928 KB
testcase_09 AC 89 ms
18,956 KB
testcase_10 AC 32 ms
18,888 KB
testcase_11 AC 64 ms
18,932 KB
testcase_12 AC 68 ms
18,968 KB
testcase_13 AC 44 ms
18,856 KB
testcase_14 AC 2,829 ms
18,928 KB
testcase_15 AC 216 ms
18,848 KB
testcase_16 AC 420 ms
18,952 KB
testcase_17 AC 2,901 ms
18,920 KB
testcase_18 AC 458 ms
19,160 KB
testcase_19 AC 163 ms
18,968 KB
testcase_20 AC 397 ms
19,064 KB
testcase_21 AC 2,473 ms
19,068 KB
testcase_22 AC 426 ms
18,860 KB
testcase_23 AC 331 ms
18,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define int long long
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 1000000007;

int dp[102][102][10010];
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, M; cin >> N >> M;
	vector<vector<int>>dp(101, vector<int>(10010));

	dp[0][0] = 1;
	for (int i = 0; i < 2 * N; i++) {
		vector<vector<int>>now(101, vector<int>(10010));
		for (int j = 0; j <= min(i, N); j++) {
			for (int k = 0; k <= N*N; k++) {
				if (i < 2 * j) {
					now[j][k] += dp[j][k];
					now[j][k] %= M;
				}
				if (k + i - j <= N * N&&j < N) {
					now[j + 1][k + i - j] += dp[j][k];
					now[j + 1][k + i - j] %= M;
				}

			}
		}
		dp = now;
	}
	for (int k = 0; k <= N * N; k++) {
		cout << dp[N][k] << '\n';
	}
	return 0;
}
0