結果

問題 No.1492 01文字列と転倒
ユーザー RaffRaff
提出日時 2022-03-08 09:04:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 844 ms / 4,000 ms
コード長 1,008 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 164,832 KB
実行使用メモリ 440,192 KB
最終ジャッジ日時 2023-09-30 14:12:28
合計ジャッジ時間 9,497 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 844 ms
439,916 KB
testcase_03 AC 782 ms
408,684 KB
testcase_04 AC 722 ms
378,488 KB
testcase_05 AC 633 ms
322,700 KB
testcase_06 AC 641 ms
335,924 KB
testcase_07 AC 693 ms
363,552 KB
testcase_08 AC 840 ms
440,192 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 640 ms
335,964 KB
testcase_15 AC 5 ms
5,236 KB
testcase_16 AC 20 ms
13,668 KB
testcase_17 AC 614 ms
322,648 KB
testcase_18 AC 21 ms
14,636 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 15 ms
11,188 KB
testcase_21 AC 523 ms
273,884 KB
testcase_22 AC 19 ms
13,624 KB
testcase_23 AC 10 ms
8,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, f, n) for (int i = (f); i < (n); i++)
#define rrep(i, f, n) for (int i = int(n) - 1; i >= f; i--)
typedef long long ll;
typedef pair<int, int> P;

template <typename T, typename U>
auto Sum(T a, U b) -> decltype(a + b)
{
    return a + b;
}

template <typename T, typename U>
inline bool amax(T &a, U b)
{
    if (b > a)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T, typename U>
inline bool amin(T &a, U b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

int dp[101][101][11001] = {};

int main()
{
    int N, M;
    cin >> N >> M;

    rep(i, 0, N + 1) dp[0][i][0] = 1;

    rep(i, 1, N + 1) rep(j, 0, N + 1) rep(k, 0, N * N + 1)
    {
        if (0 < j)
            dp[i][j][k] += dp[i][j - 1][k];
        if (j < i && j <= k)
            dp[i][j][k] += dp[i - 1][j][k - j];
        dp[i][j][k] %= M;
    }
    rep(i, 0, N * N + 1) cout << dp[N][N][i] << endl;
}
0