結果

問題 No.1989 Pairing Multiset
ユーザー tamatotamato
提出日時 2022-06-24 22:59:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2024-04-26 05:54:35
合計ジャッジ時間 2,012 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
57,472 KB
testcase_01 AC 58 ms
57,984 KB
testcase_02 AC 55 ms
57,984 KB
testcase_03 AC 57 ms
57,600 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 54 ms
57,728 KB
testcase_06 AC 38 ms
52,224 KB
testcase_07 AC 37 ms
51,968 KB
testcase_08 AC 56 ms
57,728 KB
testcase_09 AC 42 ms
57,984 KB
testcase_10 AC 47 ms
57,344 KB
testcase_11 AC 49 ms
58,240 KB
testcase_12 AC 50 ms
58,240 KB
testcase_13 AC 54 ms
57,856 KB
testcase_14 AC 43 ms
57,472 KB
testcase_15 AC 44 ms
57,600 KB
testcase_16 AC 53 ms
57,472 KB
testcase_17 AC 41 ms
57,472 KB
testcase_18 AC 37 ms
51,968 KB
testcase_19 AC 42 ms
57,472 KB
testcase_20 AC 54 ms
57,728 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