結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
18,956 KB
testcase_01 AC 58 ms
18,924 KB
testcase_02 TLE -
testcase_03 AC 3,877 ms
18,880 KB
testcase_04 AC 3,657 ms
18,956 KB
testcase_05 AC 3,138 ms
18,884 KB
testcase_06 AC 3,219 ms
18,884 KB
testcase_07 AC 3,432 ms
18,880 KB
testcase_08 TLE -
testcase_09 AC 83 ms
18,956 KB
testcase_10 AC 30 ms
18,936 KB
testcase_11 AC 65 ms
18,940 KB
testcase_12 AC 61 ms
19,012 KB
testcase_13 AC 37 ms
19,120 KB
testcase_14 AC 3,306 ms
18,940 KB
testcase_15 AC 194 ms
18,964 KB
testcase_16 AC 390 ms
18,936 KB
testcase_17 AC 3,171 ms
18,880 KB
testcase_18 AC 409 ms
18,956 KB
testcase_19 AC 144 ms
18,940 KB
testcase_20 AC 356 ms
18,896 KB
testcase_21 AC 2,785 ms
19,008 KB
testcase_22 AC 387 ms
18,956 KB
testcase_23 AC 290 ms
19,012 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