結果

問題 No.1492 01文字列と転倒
ユーザー Example0911Example0911
提出日時 2021-05-01 17:37:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,232 ms / 4,000 ms
コード長 800 bytes
コンパイル時間 2,667 ms
コンパイル使用メモリ 207,288 KB
実行使用メモリ 11,240 KB
最終ジャッジ日時 2023-09-27 07:32:15
合計ジャッジ時間 15,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
10,968 KB
testcase_01 AC 24 ms
11,060 KB
testcase_02 AC 1,232 ms
10,920 KB
testcase_03 AC 1,138 ms
10,912 KB
testcase_04 AC 1,062 ms
11,064 KB
testcase_05 AC 967 ms
11,036 KB
testcase_06 AC 1,015 ms
11,072 KB
testcase_07 AC 1,050 ms
10,920 KB
testcase_08 AC 1,200 ms
10,968 KB
testcase_09 AC 40 ms
11,192 KB
testcase_10 AC 16 ms
10,968 KB
testcase_11 AC 29 ms
11,000 KB
testcase_12 AC 29 ms
10,968 KB
testcase_13 AC 20 ms
10,988 KB
testcase_14 AC 1,000 ms
10,992 KB
testcase_15 AC 90 ms
11,032 KB
testcase_16 AC 177 ms
10,916 KB
testcase_17 AC 976 ms
10,928 KB
testcase_18 AC 187 ms
10,992 KB
testcase_19 AC 68 ms
11,240 KB
testcase_20 AC 168 ms
10,916 KB
testcase_21 AC 865 ms
11,064 KB
testcase_22 AC 183 ms
10,972 KB
testcase_23 AC 141 ms
10,924 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