結果

問題 No.2528 pop_(backfront or not)
ユーザー KoiKoi
提出日時 2023-11-03 22:32:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 77,872 KB
最終ジャッジ日時 2023-11-03 22:32:36
合計ジャッジ時間 4,687 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,676 KB
testcase_01 WA -
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 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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)
inv_facts.reverse()
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[j]%=Mod
            new_dp[-1-j]=new_dp[j]
    dp=[_ for _ in new_dp]
for i in range(2*N+1):
    print(dp[i])
        
            
0