結果

問題 No.2530 Yellow Cards
ユーザー ニックネームニックネーム
提出日時 2023-11-03 22:43:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,389 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 82,760 KB
最終ジャッジ日時 2023-11-03 22:44:10
合計ジャッジ時間 14,791 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,524 KB
testcase_01 AC 37 ms
53,524 KB
testcase_02 AC 43 ms
60,040 KB
testcase_03 AC 45 ms
62,304 KB
testcase_04 AC 34 ms
53,524 KB
testcase_05 AC 42 ms
60,040 KB
testcase_06 AC 41 ms
59,840 KB
testcase_07 AC 1,364 ms
82,760 KB
testcase_08 AC 1,217 ms
81,824 KB
testcase_09 AC 1,362 ms
82,756 KB
testcase_10 AC 1,259 ms
82,128 KB
testcase_11 AC 1,020 ms
80,480 KB
testcase_12 AC 1,389 ms
82,628 KB
testcase_13 AC 1,321 ms
82,632 KB
testcase_14 AC 1,187 ms
80,076 KB
testcase_15 AC 767 ms
77,560 KB
testcase_16 AC 681 ms
77,908 KB
testcase_17 AC 1,199 ms
80,688 KB
testcase_18 AC 336 ms
76,548 KB
testcase_19 AC 110 ms
75,728 KB
testcase_20 AC 274 ms
75,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
mod = 998244353; d = pow(n,-1,mod); dp = [1]+[0]*n; e = 0
for _ in range(k):
    eq = [0]*(n+1)
    for i in range(n+1):
        if i>0: eq[i-1] = (eq[i-1]+dp[i]*i*d)%mod
        if i<n: eq[i+1] = (eq[i+1]+dp[i]*(n-i)*d)%mod
    dp = eq
for i,v in enumerate(dp): e += ((k-i)//2+n)*v
print(e%mod)
0