結果

問題 No.1989 Pairing Multiset
ユーザー 👑 NachiaNachia
提出日時 2024-04-26 18:15:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 827 ms
コンパイル使用メモリ 79,732 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 18:15:25
合計ジャッジ時間 1,786 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
5,248 KB
testcase_01 AC 18 ms
5,376 KB
testcase_02 AC 19 ms
5,376 KB
testcase_03 AC 21 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 19 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 16 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 7 ms
5,376 KB
testcase_11 AC 12 ms
5,376 KB
testcase_12 AC 13 ms
5,376 KB
testcase_13 AC 18 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 15 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 18 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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