結果

問題 No.2530 Yellow Cards
ユーザー titiatitia
提出日時 2023-11-06 01:58:21
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 549 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 110,092 KB
最終ジャッジ日時 2023-11-06 01:58:49
合計ジャッジ時間 27,252 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,580 KB
testcase_01 AC 39 ms
53,580 KB
testcase_02 AC 275 ms
62,360 KB
testcase_03 AC 90 ms
62,352 KB
testcase_04 AC 38 ms
53,580 KB
testcase_05 AC 269 ms
62,360 KB
testcase_06 AC 45 ms
59,896 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 AC 1,890 ms
102,316 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,432 ms
89,300 KB
testcase_16 AC 1,250 ms
86,976 KB
testcase_17 TLE -
testcase_18 AC 573 ms
79,880 KB
testcase_19 AC 156 ms
76,112 KB
testcase_20 AC 613 ms
79,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K=map(int,input().split())
mod=998244353

DP=[0]*(N+K)
DP[0]=1

INV=pow(N,-1,mod)

for i in range(K):
    for j in range(N+K-2,-1,-1):
        # 今まででたカードがi枚
        # yellow 二枚がj人
        # yellow一枚は
        one=i-j*2

        # one/Nで一人増え、それ以外では増えない
        DP[j+1]+=DP[j]*one*INV
        DP[j]=DP[j]*(1-one*INV)
        DP[j]%=mod
        DP[j+1]%=mod
        

ANS=0
for i in range(N+K-1):
    ANS+=DP[i]*(i+N)
    ANS%=mod

print(ANS%mod)
0