結果

問題 No.1492 01文字列と転倒
ユーザー convexineqconvexineq
提出日時 2021-05-01 04:04:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,134 ms / 4,000 ms
コード長 408 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 329,064 KB
最終ジャッジ日時 2023-09-26 12:45:23
合計ジャッジ時間 12,370 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,568 KB
testcase_01 AC 79 ms
71,500 KB
testcase_02 AC 1,134 ms
328,124 KB
testcase_03 AC 1,070 ms
328,824 KB
testcase_04 AC 967 ms
326,448 KB
testcase_05 AC 862 ms
318,256 KB
testcase_06 AC 886 ms
317,956 KB
testcase_07 AC 933 ms
317,528 KB
testcase_08 AC 1,103 ms
329,064 KB
testcase_09 AC 83 ms
76,276 KB
testcase_10 AC 74 ms
71,380 KB
testcase_11 AC 77 ms
71,432 KB
testcase_12 AC 77 ms
71,312 KB
testcase_13 AC 76 ms
71,068 KB
testcase_14 AC 883 ms
318,048 KB
testcase_15 AC 88 ms
76,572 KB
testcase_16 AC 108 ms
77,800 KB
testcase_17 AC 833 ms
317,940 KB
testcase_18 AC 109 ms
77,944 KB
testcase_19 AC 85 ms
76,420 KB
testcase_20 AC 97 ms
76,728 KB
testcase_21 AC 743 ms
318,076 KB
testcase_22 AC 110 ms
77,928 KB
testcase_23 AC 96 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,MOD = map(int,input().split())
dp = [[1]]
for i in range(1,2*n+1):
    ndp = [[0]*((i//2)**2+1) for _ in range(i+1)]
    for j in range(i):
        for k,v in enumerate(dp[j]):
            if v==0: continue
            if j:
                ndp[j-1][k] += v
                ndp[j-1][k] %= MOD
            ndp[j+1][k+(i-j)//2] += v
            ndp[j+1][k+(i-j)//2] %= MOD
    dp = ndp
print(*dp[0],sep="\n")
0