結果

問題 No.1492 01文字列と転倒
ユーザー penguinmanpenguinman
提出日時 2021-03-30 04:10:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 488 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 169,424 KB
最終ジャッジ日時 2023-08-26 14:28:04
合計ジャッジ時間 6,649 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
70,980 KB
testcase_01 AC 61 ms
70,864 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
dp = [[[0 for i in range(2)]for j in range(N+1)]for k in range(N*N+1)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(N*N+1):
            f = (i+1)%2
            g = i%2
            dp[k][j][f] = 0
            if 0 < j:
                dp[k][j][f] += dp[k][j-1][f]
            if j <= i and j<=k:
                dp[k][j][f] += dp[k-j][j][g]
            dp[k][j][f] %= M
for i in range(N*N+1):
    print(dp[i][N][N%2])
0