結果
| 問題 |
No.1989 Pairing Multiset
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-08 04:33:32 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 2,000 ms |
| コード長 | 2,292 bytes |
| コンパイル時間 | 3,571 ms |
| コンパイル使用メモリ | 281,936 KB |
| 実行使用メモリ | 18,804 KB |
| 最終ジャッジ日時 | 2025-09-08 04:33:37 |
| 合計ジャッジ時間 | 5,483 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include<bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include<atcoder/modint>
#endif
using namespace std;
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define fo(i,...) for(auto[i,i##stop,i##step]=for_range<ll>(0,__VA_ARGS__);i<i##stop;i+=i##step)
#define of(i,...) for(auto[i,i##stop,i##step]=for_range<ll>(1,__VA_ARGS__);i>=i##stop;i+=i##step)
#define defpp template<ostream&o=cout>void pp(const auto&...a){[[maybe_unused]]const char*c="";((o<<c<<a,c=" "),...);o<<'\n';}void epp(const auto&...a){pp<cerr>(a...);}
#define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{
#define use_ml998244353 using ml=atcoder::modint998244353;
namespace my{
auto&operator<<(ostream&o,const atcoder::modint998244353&x){return o<<(int)x.val();}
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
using ll=long long;
template<class T>concept modulary=requires(T t){t.mod();};
template<class T>constexpr auto for_range(T s,T a,T b,T c=1){return array{a-s,b,(1-s*2)*c};}
void lin(auto&...a){(cin>>...>>a);}
template<class...A>using pack_back_t=tuple_element_t<sizeof...(A)-1,tuple<A...>>;
}
namespace my{
template<class V>struct vec;
template<int D,class T>struct hvec_helper{using type=vec<typename hvec_helper<D-1,T>::type>;};
template<class T>struct hvec_helper<0,T>{using type=T;};
template<int D,class T>using hvec=hvec_helper<D,T>::type;
template<class V>struct vec:vector<V>{
using vector<V>::vector;
ll size()const{return vector<V>::size();}
};
template<class...A>requires(sizeof...(A)>=2)vec(const A&...a)->vec<hvec<sizeof...(A)-2,pack_back_t<A...>>>;
}
namespace my{
template<class T>T fac(ll n){static vec<T>v{1};if(ll m=v.size();m<=n){v.resize(n+1);fo(i,m,n+1)v[i]=v[i-1]*i;}return v[n];}
template<class T>T fac_inv(ll n){static vec<T>v{1};if(ll m=v.size();m<=n){v.resize(n+1);v[n]=fac<T>(n).inv();of(i,n,m)v[i]=v[i+1]*(i+1);}return v[n];}
template<class T>T perm_small_k(ll n,ll k){if(n<0||k<0||n<k)return 0;T r=1;fo(i,n-k+1,n+1)r*=i;return r;}
template<class T>T comb_small_k(ll n,ll k){
if(n<0||k<0||n<k)return 0;
if(k>n-k)k=n-k;
if constexpr(modulary<T>)return perm_small_k<T>(n,k)*fac_inv<T>(k);
else { }
}
}
namespace my{entry
void main(){
LL(N,M);
use_ml998244353
pp(N*comb_small_k<ml>(N*2+M,N*2+1));
}}