結果

問題 No.1492 01文字列と転倒
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-09 15:23:17
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 546 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 283,764 KB
最終ジャッジ日時 2023-08-09 04:47:40
合計ジャッジ時間 38,264 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,376 KB
testcase_01 AC 71 ms
71,304 KB
testcase_02 TLE -
testcase_03 AC 3,995 ms
280,140 KB
testcase_04 AC 3,538 ms
283,764 KB
testcase_05 AC 2,977 ms
280,468 KB
testcase_06 AC 3,203 ms
280,876 KB
testcase_07 AC 3,278 ms
280,500 KB
testcase_08 TLE -
testcase_09 AC 75 ms
75,860 KB
testcase_10 AC 72 ms
71,376 KB
testcase_11 AC 71 ms
71,308 KB
testcase_12 AC 73 ms
71,488 KB
testcase_13 AC 71 ms
71,172 KB
testcase_14 AC 3,073 ms
280,772 KB
testcase_15 AC 85 ms
75,908 KB
testcase_16 AC 142 ms
78,380 KB
testcase_17 AC 2,988 ms
280,468 KB
testcase_18 AC 151 ms
78,344 KB
testcase_19 AC 83 ms
76,036 KB
testcase_20 AC 121 ms
77,660 KB
testcase_21 AC 2,513 ms
282,068 KB
testcase_22 AC 140 ms
78,260 KB
testcase_23 AC 96 ms
76,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():

    n, mod = map(int, input().split())

    dp = [[0]*(n**2+1) for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        nx = [[0]*(n**2+1) for i in range(n+1)]
        for j in range(n+1):
            for k in range(n**2+1):
                if j-1 >= 0:
                    nx[j][k] += nx[j-1][k]
                if j <= i and j <= k:
                    nx[j][k] += dp[j][k-j]
                nx[j][k] %= mod
        dp = nx
    for i in range(n**2+1):
        print(dp[n][i]%mod)

if __name__ == '__main__':
    main()
0