結果

問題 No.1492 01文字列と転倒
ユーザー se1ka2se1ka2
提出日時 2021-04-30 21:37:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 634 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 65,404 KB
実行使用メモリ 19,440 KB
最終ジャッジ日時 2023-08-14 11:22:11
合計ジャッジ時間 37,994 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
19,228 KB
testcase_01 AC 27 ms
19,224 KB
testcase_02 TLE -
testcase_03 AC 3,855 ms
19,240 KB
testcase_04 AC 3,604 ms
19,224 KB
testcase_05 AC 3,096 ms
19,328 KB
testcase_06 AC 3,176 ms
19,260 KB
testcase_07 AC 3,461 ms
19,236 KB
testcase_08 TLE -
testcase_09 AC 30 ms
19,440 KB
testcase_10 AC 22 ms
19,360 KB
testcase_11 AC 28 ms
19,232 KB
testcase_12 AC 28 ms
19,240 KB
testcase_13 AC 25 ms
19,316 KB
testcase_14 AC 3,212 ms
19,232 KB
testcase_15 AC 56 ms
19,228 KB
testcase_16 AC 133 ms
19,236 KB
testcase_17 AC 3,041 ms
19,260 KB
testcase_18 AC 143 ms
19,316 KB
testcase_19 AC 45 ms
19,240 KB
testcase_20 AC 106 ms
19,276 KB
testcase_21 AC 2,540 ms
19,280 KB
testcase_22 AC 133 ms
19,236 KB
testcase_23 AC 88 ms
19,276 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 <= n * n; j++){
            for(int k = 0; k <= n; k++) d[j][k] = 0;
        }
        for(int j = 0; j <= n * n; j++){
            for(int k = 0; k <= n; 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