結果

問題 No.1989 Pairing Multiset
ユーザー 👑 tamatotamato
提出日時 2022-06-24 22:59:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 75,628 KB
最終ジャッジ日時 2023-08-08 13:04:58
合計ジャッジ時間 3,246 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
75,556 KB
testcase_01 AC 84 ms
75,276 KB
testcase_02 AC 85 ms
75,516 KB
testcase_03 AC 85 ms
75,424 KB
testcase_04 AC 69 ms
71,444 KB
testcase_05 AC 86 ms
75,496 KB
testcase_06 AC 69 ms
71,400 KB
testcase_07 AC 68 ms
71,296 KB
testcase_08 AC 85 ms
75,224 KB
testcase_09 AC 72 ms
75,412 KB
testcase_10 AC 76 ms
75,612 KB
testcase_11 AC 79 ms
75,612 KB
testcase_12 AC 81 ms
75,496 KB
testcase_13 AC 84 ms
75,412 KB
testcase_14 AC 71 ms
75,328 KB
testcase_15 AC 71 ms
75,408 KB
testcase_16 AC 83 ms
75,628 KB
testcase_17 AC 72 ms
75,212 KB
testcase_18 AC 69 ms
71,448 KB
testcase_19 AC 71 ms
75,556 KB
testcase_20 AC 88 ms
75,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    from itertools import combinations_with_replacement
    input = sys.stdin.readline

    def guchoku(N, M):
        res = 0
        for p in combinations_with_replacement(list(range(M+1)), 2 * N):
            p = list(p)
            #print(p)
            for i in range(N):
                res += p[i*2+1] - p[i*2]
        return res

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

    #print(guchoku(N, M))

    upper = N
    lower = 1
    for i in range(2 * N + 1):
        upper = (upper * (M + 2 * N - i)) % mod
        lower = (lower * (2 * N + 1 - i)) % mod
    print((upper * pow(lower, mod - 2, mod)) % mod)


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