結果

問題 No.1989 Pairing Multiset
ユーザー 👑 Nachia
提出日時 2024-04-26 18:15:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 75,848 KB
最終ジャッジ日時 2025-02-21 09:09:17
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <atcoder/modint>

using namespace std;
using i64 = long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
using modint = atcoder::static_modint<998244353>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    i64 N, M; cin >> N >> M;
    modint factN = 1;
    for(int i=1; i<=2*N; i++) factN *= i;
    modint comb = factN.inv();
    for(int i=M+1; i<=M+2*N; i++) comb *= i;

    modint ans = comb * M * N / (2*N+1);
    cout << ans.val() << '\n';
    return 0;
}
0