結果

問題 No.1492 01文字列と転倒
ユーザー ああああ
提出日時 2022-10-17 20:47:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,339 ms / 4,000 ms
コード長 515 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 86,460 KB
実行使用メモリ 307,168 KB
最終ジャッジ日時 2023-09-10 19:10:15
合計ジャッジ時間 13,768 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,728 KB
testcase_01 AC 73 ms
71,012 KB
testcase_02 AC 1,339 ms
303,412 KB
testcase_03 AC 1,237 ms
306,052 KB
testcase_04 AC 1,132 ms
307,168 KB
testcase_05 AC 970 ms
293,524 KB
testcase_06 AC 988 ms
295,664 KB
testcase_07 AC 1,082 ms
299,640 KB
testcase_08 AC 1,312 ms
303,288 KB
testcase_09 AC 77 ms
75,696 KB
testcase_10 AC 71 ms
71,020 KB
testcase_11 AC 71 ms
71,068 KB
testcase_12 AC 71 ms
70,872 KB
testcase_13 AC 70 ms
70,548 KB
testcase_14 AC 996 ms
295,988 KB
testcase_15 AC 85 ms
75,792 KB
testcase_16 AC 111 ms
77,348 KB
testcase_17 AC 955 ms
293,708 KB
testcase_18 AC 109 ms
77,360 KB
testcase_19 AC 80 ms
75,748 KB
testcase_20 AC 105 ms
77,112 KB
testcase_21 AC 817 ms
287,144 KB
testcase_22 AC 109 ms
77,552 KB
testcase_23 AC 95 ms
77,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())



dp=[[0]*(N**2+1) for _ in range(N+1)] 
dp[0][0]=1

for i in range(N*2):
    ndp=[[0]*(N**2+1) for _ in range(N+1)] 
    for j in range((i+1)//2,min(i,N)+1):
        for k in range(min(i**2,N**2)+1):
            #if dp[j][k]==0:
            #    continue
            ndp[j][k]+=dp[j][k]
            ndp[j][k]%=M
            if j+1<=N and k+i-j<N**2+1:
                ndp[j+1][k+i-j]+=dp[j][k]
                ndp[j][k]%=M
    dp=ndp
for i in range(N**2+1):
    print(dp[N][i]%M)




0