結果
問題 | No.2141 Enumeratest |
ユーザー | moririn2528_c |
提出日時 | 2022-12-02 21:33:35 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 162 ms / 2,000 ms |
コード長 | 5,857 bytes |
コンパイル時間 | 1,303 ms |
コンパイル使用メモリ | 125,884 KB |
実行使用メモリ | 18,924 KB |
最終ジャッジ日時 | 2024-10-09 22:39:37 |
合計ジャッジ時間 | 8,281 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 155 ms
18,680 KB |
testcase_01 | AC | 155 ms
18,688 KB |
testcase_02 | AC | 156 ms
18,688 KB |
testcase_03 | AC | 155 ms
18,712 KB |
testcase_04 | AC | 159 ms
18,924 KB |
testcase_05 | AC | 158 ms
18,816 KB |
testcase_06 | AC | 156 ms
18,800 KB |
testcase_07 | AC | 156 ms
18,816 KB |
testcase_08 | AC | 157 ms
18,884 KB |
testcase_09 | AC | 158 ms
18,816 KB |
testcase_10 | AC | 157 ms
18,688 KB |
testcase_11 | AC | 156 ms
18,816 KB |
testcase_12 | AC | 157 ms
18,816 KB |
testcase_13 | AC | 156 ms
18,884 KB |
testcase_14 | AC | 156 ms
18,808 KB |
testcase_15 | AC | 155 ms
18,816 KB |
testcase_16 | AC | 156 ms
18,808 KB |
testcase_17 | AC | 157 ms
18,900 KB |
testcase_18 | AC | 158 ms
18,816 KB |
testcase_19 | AC | 159 ms
18,816 KB |
testcase_20 | AC | 159 ms
18,816 KB |
testcase_21 | AC | 159 ms
18,816 KB |
testcase_22 | AC | 157 ms
18,816 KB |
testcase_23 | AC | 157 ms
18,800 KB |
testcase_24 | AC | 158 ms
18,816 KB |
testcase_25 | AC | 156 ms
18,816 KB |
testcase_26 | AC | 158 ms
18,816 KB |
testcase_27 | AC | 162 ms
18,688 KB |
testcase_28 | AC | 159 ms
18,920 KB |
testcase_29 | AC | 158 ms
18,816 KB |
testcase_30 | AC | 159 ms
18,816 KB |
testcase_31 | AC | 158 ms
18,816 KB |
testcase_32 | AC | 157 ms
18,816 KB |
testcase_33 | AC | 158 ms
18,816 KB |
testcase_34 | AC | 157 ms
18,816 KB |
testcase_35 | AC | 157 ms
18,832 KB |
testcase_36 | AC | 158 ms
18,684 KB |
ソースコード
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<vector> #include<cmath> #include<algorithm> #include<map> #include<queue> #include<deque> #include<iomanip> #include<tuple> #include<cassert> #include<set> #include<complex> #include<numeric> #include<functional> #include<unordered_map> #include<unordered_set> using namespace std; typedef long long int LL; typedef pair<int,int> P; typedef pair<LL,LL> LP; const int INF=1<<30; const LL MAX=1e9+7; void array_show(int *array,int array_n,char middle=' '){ for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n')); } void array_show(LL *array,int array_n,char middle=' '){ for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n')); } void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){ if(vec_n==-1)vec_n=vec_s.size(); for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n')); } void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){ if(vec_n==-1)vec_n=vec_s.size(); for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n')); } template<typename T> ostream& operator<<(ostream& os,const vector<T>& v1){ int n=v1.size(); for(int i=0;i<n;i++){ if(i)os<<" "; os<<v1[i]; } return os; } template<typename T1,typename T2> ostream& operator<<(ostream& os,const pair<T1,T2>& p){ os<<p.first<<" "<<p.second; return os; } template<typename T> istream& operator>>(istream& is,vector<T>& v1){ int n=v1.size(); for(int i=0;i<n;i++)is>>v1[i]; return is; } template<typename T1,typename T2> istream& operator>>(istream& is,pair<T1,T2>& p){ is>>p.first>>p.second; return is; } template<typename T>T ext_gcd(T a,T b,T& x,T& y){ //ax+by=gcd(a,b) if(a<b)return ext_gcd(b,a,y,x); if(b==0){ x=1,y=0; return a; } T gcd_val=ext_gcd(b,a%b,x,y); swap(x,y); y-=x*(a/b); if(x>b)y+=(x/b)*a,x%=b; if(y>a)x+=(y/a)*b,y%=a; return gcd_val; } template<long long int mod,bool prime=false>class modint{ private: typedef long long int ll; ll val; ll gcd(ll a,ll b){ if(a<b)swap(a,b); if(b==0)return a; return gcd(b,a%b); } public: modint():val(0){} template<class T>modint(T a){ val=(ll)a%mod; if(val<0)val+=mod; } ll value()const{return val;} ll get_mod()const{return mod;} modint& operator++(){ val++; if(val==mod)val=0; return *this; } modint operator++(int){ modint ans=*this; ++*this; return ans; } modint& operator--(){ if(val==0)val=mod; val--; return *this; } modint operator--(int){ modint ans=*this; --*this; return ans; } modint& operator+=(const modint& a){ val+=a.value(); if(val>=mod)val-=mod; return *this; } modint& operator-=(const modint& a){ val-=a.value(); if(val<0)val+=mod; return *this; } modint& operator*=(const modint& a){ val*=a.value(); if(val>=mod)val%=mod; return *this; } modint pow(ll index)const{ assert(index>=0); if(prime && index>=mod-1)index%=mod-1; modint a=*this,ans=1; for(ll i=1;i>=0 && i<=index;i<<=1){ if(index&i)ans*=a; a*=a; } return ans; } modint inverse()const{ if(prime){ assert(val!=0); return pow(mod-2); } ll x,y; ll g=ext_gcd<ll>(val,mod,x,y); assert(g==1); return x; } modint& operator/=(const modint& a){ if(prime){ *this=(*this)*a.inverse(); return *this; } ll g=gcd(val,a.value()); modint a2=a.value()/g; val/=g; *this=(*this)*a2.inverse(); return *this; } friend modint operator-(const modint& a,const modint& b){return (modint)a-=b;} friend modint operator+(const modint& a,const modint& b){return (modint)a+=b;} friend modint operator*(const modint& a,const modint& b){return (modint)a*=b;} friend modint operator/(const modint& a,const modint& b){return (modint)a/=b;} friend bool operator==(const modint& a,const modint& b){return a.value()==b.value();} friend bool operator!=(const modint& a,const modint& b){return a.value()!=b.value();} friend modint pow(const modint& a,const ll b){return a.pow(b);} modint operator+() const{return *this;} modint operator-() const{return modint()-*this;} friend ostream& operator<<(ostream& os,const modint& a){ os<<a.value(); return os; } friend istream& operator>>(istream& is,modint& a){ ll val; is>>val; a=val; return is; } }; using modint107=modint<1'000'000'007,true>; using modint109=modint<1'000'000'009,true>; using mint=modint<998'244'353,true>; class Comb{ public: vector<mint> kai,rk; Comb(int n){ assert(n>0); kai.resize(n+1); rk.resize(n+1); kai[0]=1; rk[0]=1; for(int i=1;i<=n;i++){ kai[i]=kai[i-1]*i; rk[i]=rk[i-1]/i; } } mint C(int a,int b){ if(b<0 || a<b)return 0; return kai[a]*rk[b]*rk[a-b]; } mint P(int a,int b){ if(b<0 || a<b)return 0; return kai[a]*rk[b]; } }; namespace sol{ void solve(){ int n,m; int i,j,k; int a,b,c; const int N=1e6+7; Comb ca(N); cin>>n>>m; mint s=1; for(i=0;i<n;i++){ s*=ca.rk[(m+i)/n]; } s*=ca.kai[m]; cout<<s<<endl; } } int main(){ cin.tie(0); ios::sync_with_stdio(false); sol::solve(); }