結果

問題 No.1492 01文字列と転倒
ユーザー shiomusubi496shiomusubi496
提出日時 2021-04-30 21:52:29
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,460 ms / 4,000 ms
コード長 444 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 199,104 KB
実行使用メモリ 414,080 KB
最終ジャッジ日時 2023-09-26 05:54:47
合計ジャッジ時間 15,181 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1,458 ms
414,028 KB
testcase_03 AC 1,363 ms
397,848 KB
testcase_04 AC 1,256 ms
371,912 KB
testcase_05 AC 1,065 ms
316,244 KB
testcase_06 AC 1,113 ms
329,568 KB
testcase_07 AC 1,210 ms
357,288 KB
testcase_08 AC 1,460 ms
414,080 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1,119 ms
329,580 KB
testcase_15 AC 5 ms
4,832 KB
testcase_16 AC 28 ms
12,068 KB
testcase_17 AC 1,064 ms
316,256 KB
testcase_18 AC 30 ms
13,172 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 20 ms
9,972 KB
testcase_21 AC 894 ms
267,396 KB
testcase_22 AC 27 ms
12,068 KB
testcase_23 AC 13 ms
7,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
int N,M,dp[102][102][10001];
signed main(){
    cin>>N>>M;
    dp[0][0][0]=1;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=i;j++){
            for(int k=0;k+j<=N*N;k++) (dp[i+1][j][k+j]+=dp[i][j][k])%=M;
            if(j==i)continue;
            for(int k=0;k<=N*N;k++) (dp[i][j+1][k]+=dp[i][j][k])%=M;
        }
    }
    for(int i=0;i<=N*N;i++)cout<<dp[N][N][i]<<endl;
}
0