結果

問題 No.1492 01文字列と転倒
ユーザー se1ka2se1ka2
提出日時 2021-04-30 21:40:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 642 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 65,096 KB
実行使用メモリ 19,612 KB
最終ジャッジ日時 2023-09-26 05:32:01
合計ジャッジ時間 8,748 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
19,348 KB
testcase_01 AC 26 ms
19,276 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 32 ms
19,420 KB
testcase_10 AC 23 ms
19,612 KB
testcase_11 AC 31 ms
19,288 KB
testcase_12 AC 29 ms
19,280 KB
testcase_13 AC 24 ms
19,412 KB
testcase_14 RE -
testcase_15 AC 54 ms
19,568 KB
testcase_16 AC 151 ms
19,280 KB
testcase_17 RE -
testcase_18 AC 153 ms
19,288 KB
testcase_19 AC 46 ms
19,324 KB
testcase_20 AC 115 ms
19,424 KB
testcase_21 RE -
testcase_22 AC 140 ms
19,296 KB
testcase_23 AC 95 ms
19,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

ll dp[10002][102];
ll d[10002][102];

int main()
{
    int n;
    ll m;
    cin >> n >> m;
    dp[0][0] = 1;
    for(int i = 1; i <= n * 2; i++){
        for(int j = 0; j <= i * i; j++){
            for(int k = 0; k * 2 <= i; k++) d[j][k] = 0;
        }
        for(int j = 0; j <= i * i; j++){
            for(int k = 0; k * 2 <= i; k++) d[j + k][k] = (d[j + k][k] + dp[j][k]) % m;
            for(int k = 0; (k + 1) * 2 <= i; k++) d[j][k + 1] = (d[j][k + 1] + dp[j][k]) % m;
        }
        swap(dp, d);
    }
    for(int j = 0; j <= n * n; j++) cout << dp[j][n] << endl;
}
0