結果

問題 No.1967 Sugoroku Optimization
ユーザー prussian_coderprussian_coder
提出日時 2022-06-04 20:17:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 75,552 KB
最終ジャッジ日時 2023-10-21 02:49:45
合計ジャッジ時間 2,595 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,356 KB
testcase_01 AC 38 ms
53,356 KB
testcase_02 AC 40 ms
53,356 KB
testcase_03 AC 113 ms
75,544 KB
testcase_04 AC 47 ms
61,896 KB
testcase_05 AC 110 ms
75,536 KB
testcase_06 AC 108 ms
75,532 KB
testcase_07 AC 48 ms
61,924 KB
testcase_08 AC 95 ms
75,544 KB
testcase_09 AC 85 ms
75,544 KB
testcase_10 AC 69 ms
75,504 KB
testcase_11 AC 50 ms
63,972 KB
testcase_12 AC 88 ms
75,532 KB
testcase_13 AC 73 ms
75,532 KB
testcase_14 AC 51 ms
63,972 KB
testcase_15 AC 48 ms
63,972 KB
testcase_16 AC 48 ms
63,972 KB
testcase_17 AC 45 ms
61,584 KB
testcase_18 AC 43 ms
59,536 KB
testcase_19 AC 37 ms
53,356 KB
testcase_20 AC 110 ms
75,544 KB
testcase_21 AC 36 ms
53,356 KB
testcase_22 AC 109 ms
75,544 KB
testcase_23 AC 89 ms
75,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
mod=998244353
dp=[0 for _ in range(N+1)]
dp[-1]=1
inv=[pow(i,mod-2,mod) for i in range(N+1)]
for _ in range(M):
	dp2=[0 for _ in range(N+1)]
	dp2[-1]=1
	a=0
	for j in range(N):
		a+=dp[-j-1]
		a%=mod
		dp2[-j-2]=a*inv[j+1]%mod
	dp=dp2.copy()
print(dp[0])
0