結果

問題 No.2528 pop_(backfront or not)
ユーザー KoiKoi
提出日時 2023-11-03 22:20:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 273,260 KB
最終ジャッジ日時 2023-11-03 22:20:49
合計ジャッジ時間 5,709 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
66,712 KB
testcase_01 AC 43 ms
59,688 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

Mod=998244353
N=int(input())
dp=[0]*(2*N+1)
dp[0]=1
facts=[]
inv_facts=[]
t=1
for i in range(4100+1):
    facts.append(t)
    t=t*(i+1)%Mod
inv_facts.append(pow(facts[4100],-1,Mod))
for i in range(4100):
    inv_facts.append(inv_facts[-1]*(4100-i)%Mod)
def Comb(n,k):
    if(n<k or n<0):
        return 0
    return facts[n]*inv_facts[k]*inv_facts[n-k]%Mod
inv_facts.reverse()
for i in range(1,N+1):
    M=2*i+1
    new_dp=[0]*(2*N+1)
    for j in range(M//2+1):
        if(j==0):
            continue
        else:
            new_dp[j]=dp[j-1]+dp[j-2]*Comb(j-1,2)+dp[j-1]*(j-1)*(M-j-2)%Mod+dp[j]*Comb(M-j-2,2)
            new_dp[-1-j]=new_dp[j]
    dp=[_ for _ in new_dp]
for i in range(2*N+1):
    print(dp[i])
        
            
0