結果

問題 No.1492 01文字列と転倒
ユーザー KudeKude
提出日時 2021-04-30 21:57:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 282 ms / 4,000 ms
コード長 1,198 bytes
コンパイル時間 4,280 ms
コンパイル使用メモリ 261,208 KB
実行使用メモリ 11,468 KB
最終ジャッジ日時 2023-09-26 06:01:17
合計ジャッジ時間 7,722 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
11,316 KB
testcase_01 AC 6 ms
11,368 KB
testcase_02 AC 282 ms
11,276 KB
testcase_03 AC 258 ms
11,316 KB
testcase_04 AC 235 ms
11,364 KB
testcase_05 AC 201 ms
11,312 KB
testcase_06 AC 210 ms
11,364 KB
testcase_07 AC 226 ms
11,420 KB
testcase_08 AC 277 ms
11,468 KB
testcase_09 AC 6 ms
11,400 KB
testcase_10 AC 6 ms
11,304 KB
testcase_11 AC 5 ms
11,268 KB
testcase_12 AC 5 ms
11,340 KB
testcase_13 AC 5 ms
11,348 KB
testcase_14 AC 203 ms
11,392 KB
testcase_15 AC 6 ms
11,308 KB
testcase_16 AC 9 ms
11,280 KB
testcase_17 AC 195 ms
11,276 KB
testcase_18 AC 9 ms
11,352 KB
testcase_19 AC 6 ms
11,348 KB
testcase_20 AC 8 ms
11,308 KB
testcase_21 AC 161 ms
11,408 KB
testcase_22 AC 8 ms
11,276 KB
testcase_23 AC 7 ms
11,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n)for (int i = 0; i < int(n); ++i)
#define rrep(i,n)for (int i = int(n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
template<class T> void chmax(T& a, const T& b) {a = max(a, b);}
template<class T> void chmin(T& a, const T& b) {a = min(a, b);}
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using mint = modint;
mint dp[101][10001];
mint ndp[101][10001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    mint::set_mod(m);
    dp[0][0] = 1;
    rep(i, 2 * n) {
        rep(j, n + 1) rep(k, n * n + 1) ndp[j][k] = mint::raw(0);
        rep(j, n + 1) rep(k, n * n + 1) if (dp[j][k].val()) {
            int rcnt = (i - j) / 2;
            if (j + 1 <= n && k + rcnt <= n * n) ndp[j + 1][k + rcnt] += dp[j][k];
            if (j - 1 >= 0) ndp[j - 1][k] += dp[j][k];
        }
        rep(j, n + 1) rep(k, n * n + 1) dp[j][k] = ndp[j][k];
    }
    rep(k, n * n + 1) cout << dp[0][k].val() << '\n';
}
0