結果

問題 No.1492 01文字列と転倒
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-09 15:23:17
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 546 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 284,612 KB
最終ジャッジ日時 2024-04-26 19:48:13
合計ジャッジ時間 36,256 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,968 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 TLE -
testcase_03 AC 3,772 ms
280,704 KB
testcase_04 AC 3,485 ms
284,612 KB
testcase_05 AC 3,009 ms
279,132 KB
testcase_06 AC 3,102 ms
279,348 KB
testcase_07 AC 3,344 ms
272,656 KB
testcase_08 TLE -
testcase_09 AC 43 ms
58,740 KB
testcase_10 AC 39 ms
51,712 KB
testcase_11 AC 39 ms
51,968 KB
testcase_12 AC 40 ms
51,840 KB
testcase_13 AC 40 ms
51,968 KB
testcase_14 AC 3,121 ms
279,424 KB
testcase_15 AC 56 ms
62,472 KB
testcase_16 AC 122 ms
77,312 KB
testcase_17 AC 2,976 ms
279,516 KB
testcase_18 AC 132 ms
77,096 KB
testcase_19 AC 53 ms
60,288 KB
testcase_20 AC 102 ms
76,160 KB
testcase_21 AC 2,620 ms
279,680 KB
testcase_22 AC 128 ms
77,164 KB
testcase_23 AC 81 ms
71,424 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