結果

問題 No.1856 Mex Sum 2
ユーザー 👑 colognecologne
提出日時 2022-02-28 17:06:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 611 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 81,092 KB
最終ジャッジ日時 2023-09-21 01:29:46
合計ジャッジ時間 7,819 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,356 KB
testcase_01 AC 72 ms
71,340 KB
testcase_02 AC 100 ms
76,212 KB
testcase_03 AC 72 ms
71,252 KB
testcase_04 AC 79 ms
76,324 KB
testcase_05 AC 79 ms
76,004 KB
testcase_06 AC 79 ms
75,568 KB
testcase_07 AC 82 ms
76,228 KB
testcase_08 AC 73 ms
71,244 KB
testcase_09 AC 76 ms
75,632 KB
testcase_10 AC 80 ms
76,156 KB
testcase_11 AC 75 ms
75,248 KB
testcase_12 AC 72 ms
71,008 KB
testcase_13 AC 72 ms
71,320 KB
testcase_14 AC 71 ms
71,348 KB
testcase_15 AC 72 ms
71,004 KB
testcase_16 AC 79 ms
76,208 KB
testcase_17 AC 84 ms
76,096 KB
testcase_18 AC 81 ms
76,080 KB
testcase_19 AC 77 ms
76,272 KB
testcase_20 AC 78 ms
76,260 KB
testcase_21 AC 72 ms
71,356 KB
testcase_22 AC 86 ms
76,512 KB
testcase_23 AC 72 ms
71,344 KB
testcase_24 AC 82 ms
76,084 KB
testcase_25 AC 90 ms
76,456 KB
testcase_26 AC 73 ms
71,152 KB
testcase_27 AC 72 ms
71,420 KB
testcase_28 AC 73 ms
71,252 KB
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    MOD = 998244353

    N, M = map(int, input().split())

    f = [0] * (N+1)
    for mex in range(1, min(N, M+1)+1):
        DP = [1] + [0] * mex
        for i in range(1, N+1):
            for j in range(mex, -1, -1):
                DP[j] = (((M+1)-(mex-j)) * DP[j] + (mex-(j-1))
                         * (DP[j-1] if j != 0 else 0)) % MOD
            f[i] = (f[i] + DP[-1]) % MOD

    ans = 0
    C = 1
    for i in range(1, N+1):
        C = C * (N-i+1) * pow(i, -1, MOD) % MOD
        ans = (ans + pow(M+1, N-i, MOD) * C * f[i]) % MOD

    print(ans)


if __name__ == '__main__':
    main()
0