結果
問題 | No.1989 Pairing Multiset |
ユーザー |
![]() |
提出日時 | 2022-06-25 10:02:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,309 ms / 2,000 ms |
コード長 | 1,138 bytes |
コンパイル時間 | 9,338 ms |
コンパイル使用メモリ | 426,196 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 05:09:19 |
合計ジャッジ時間 | 23,440 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#define _GLIBCXX_DEBUG //遅い可能性がある#include <bits/stdc++.h>#include<atcoder/all>#include<boost/multiprecision/cpp_int.hpp> //多倍長using namespace boost::multiprecision; // 多倍長.型はcpp_intusing namespace atcoder;using namespace std;#define rep(i, n) for (ll i = 0; i < (int)(n); i++)#define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x)using ll = long long;using P = pair<int,int>;using VI = vector<int>;using VVI = vector<vector<int>>;ll MOD = 998244353;int INF = 100100100;const vector<int> dx = {1, 0, -1, 0};const vector<int> dy = {0, 1, 0, -1};int depth[110000];int mxdepth[110000];long long modpow(long long a, long long n, long long mod) {long long res = 1;if (a == 0) return 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}int main() {int N,M;cin >> N >> M;ll ans = N;ll n = 2*N+M;ll k = 2*N+1;rep(i,k){ll temp = (n-i) * modpow(i+1,MOD-2,MOD)%MOD;ans *= temp%MOD;ans %= MOD;}cout << ans << endl;return 0;}