結果

問題 No.1492 01文字列と転倒
ユーザー Example0911Example0911
提出日時 2021-05-01 17:21:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 786 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 207,812 KB
実行使用メモリ 19,168 KB
最終ジャッジ日時 2023-09-27 07:15:32
合計ジャッジ時間 45,981 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
18,836 KB
testcase_01 AC 57 ms
18,840 KB
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 3,593 ms
19,000 KB
testcase_06 AC 3,721 ms
18,940 KB
testcase_07 AC 3,955 ms
19,168 KB
testcase_08 TLE -
testcase_09 AC 95 ms
18,856 KB
testcase_10 AC 35 ms
18,936 KB
testcase_11 AC 74 ms
18,936 KB
testcase_12 AC 75 ms
18,940 KB
testcase_13 AC 48 ms
18,836 KB
testcase_14 AC 3,673 ms
18,852 KB
testcase_15 AC 230 ms
18,896 KB
testcase_16 AC 462 ms
18,968 KB
testcase_17 AC 3,529 ms
18,840 KB
testcase_18 AC 482 ms
18,896 KB
testcase_19 AC 185 ms
18,848 KB
testcase_20 AC 425 ms
18,952 KB
testcase_21 AC 3,139 ms
18,932 KB
testcase_22 AC 482 ms
18,952 KB
testcase_23 AC 357 ms
18,968 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;


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 <= N; j++) {
			for (int k = 0; k <= N*N; k++) {
				now[j][k] += dp[j][k];
				now[j][k] %= M;
				if (i - j >= j + 1) {
					int nk = k;
					nk += N - (i - j);
					if (nk >= 0) {
						now[j + 1][nk] += dp[j][k];
						now[j + 1][nk] %= M;
					}
				}
				
			}
		}
		dp = now;
	}
	for (int k = 0; k <= N * N; k++) {
		cout << dp[N][k] << '\n';
	}
	return 0;
}
0