結果

問題 No.2528 pop_(backfront or not)
ユーザー ニックネームニックネーム
提出日時 2023-11-03 21:56:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 138,372 KB
最終ジャッジ日時 2023-11-03 21:56:41
合計ジャッジ時間 3,930 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,544 KB
testcase_01 AC 36 ms
53,544 KB
testcase_02 AC 35 ms
53,544 KB
testcase_03 AC 35 ms
53,544 KB
testcase_04 AC 36 ms
53,544 KB
testcase_05 AC 45 ms
61,964 KB
testcase_06 AC 48 ms
62,320 KB
testcase_07 AC 51 ms
64,376 KB
testcase_08 AC 60 ms
66,472 KB
testcase_09 AC 84 ms
74,272 KB
testcase_10 AC 142 ms
91,968 KB
testcase_11 AC 145 ms
92,372 KB
testcase_12 AC 174 ms
92,492 KB
testcase_13 AC 183 ms
93,432 KB
testcase_14 AC 220 ms
108,960 KB
testcase_15 AC 305 ms
127,284 KB
testcase_16 AC 354 ms
138,372 KB
testcase_17 AC 353 ms
138,360 KB
testcase_18 AC 358 ms
138,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input()); mod = 998244353
dp = [[0]*(2*n+1-i) for i in range(2*n+1)]; dp[1][1] = 1
for i in range(1,2*n+1):
    for j in range(1,2*n+1-i):
        if i>2: dp[i][j] += (i-2)*(i-1)//2*dp[i-2][j]
        if j>2: dp[i][j] += (j-2)*(j-1)//2*dp[i][j-2]
        if i>1<j: dp[i][j] += dp[i-1][j-1]*(i*j-i-j+2)
        dp[i][j] %= mod
for i in range(2*n+1): print(dp[i][-1])
0