結果

問題 No.2141 Enumeratest
ユーザー 沙耶花沙耶花
提出日時 2022-12-02 21:23:07
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,054 bytes
コンパイル時間 4,496 ms
コンパイル使用メモリ 259,240 KB
実行使用メモリ 15,384 KB
最終ジャッジ日時 2024-04-18 05:06:34
合計ジャッジ時間 6,460 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
11,776 KB
testcase_01 AC 22 ms
11,776 KB
testcase_02 AC 22 ms
11,904 KB
testcase_03 AC 24 ms
11,648 KB
testcase_04 AC 30 ms
15,360 KB
testcase_05 AC 28 ms
15,384 KB
testcase_06 AC 21 ms
11,904 KB
testcase_07 AC 21 ms
11,648 KB
testcase_08 AC 22 ms
11,776 KB
testcase_09 AC 22 ms
11,648 KB
testcase_10 AC 23 ms
11,776 KB
testcase_11 AC 24 ms
11,648 KB
testcase_12 AC 21 ms
11,776 KB
testcase_13 AC 22 ms
11,776 KB
testcase_14 AC 24 ms
11,904 KB
testcase_15 AC 24 ms
11,776 KB
testcase_16 AC 24 ms
11,648 KB
testcase_17 AC 28 ms
13,952 KB
testcase_18 AC 28 ms
14,672 KB
testcase_19 AC 31 ms
14,848 KB
testcase_20 AC 28 ms
14,208 KB
testcase_21 AC 29 ms
14,464 KB
testcase_22 AC 26 ms
13,696 KB
testcase_23 AC 24 ms
12,544 KB
testcase_24 AC 26 ms
12,416 KB
testcase_25 AC 23 ms
11,648 KB
testcase_26 AC 27 ms
14,916 KB
testcase_27 AC 28 ms
14,464 KB
testcase_28 AC 28 ms
15,312 KB
testcase_29 AC 26 ms
13,440 KB
testcase_30 AC 29 ms
14,964 KB
testcase_31 AC 27 ms
13,952 KB
testcase_32 AC 28 ms
14,080 KB
testcase_33 AC 27 ms
13,824 KB
testcase_34 AC 28 ms
13,568 KB
testcase_35 AC 22 ms
11,776 KB
testcase_36 AC 29 ms
14,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

struct combi{
	deque<mint> kaijou;
	deque<mint> kaijou_;
	
	combi(int n){
		kaijou.push_back(1);
		for(int i=1;i<=n;i++){
			kaijou.push_back(kaijou[i-1]*i);
		}
		
		mint b=kaijou[n].inv();
		
		kaijou_.push_front(b);
		for(int i=1;i<=n;i++){
			int k=n+1-i;
			kaijou_.push_front(kaijou_[0]*k);
		}
	}
	
	mint combination(int n,int r){
		if(r>n)return 0;
		mint a = kaijou[n]*kaijou_[r];
		a *= kaijou_[n-r];
		return a;
	}
	
	mint junretsu(int a,int b){
		mint x = kaijou_[a]*kaijou_[b];
		x *= kaijou[a+b];
		return x;
	}
	
	mint catalan(int n){
		return combination(2*n,n)/(n+1);
	}
	
};

int main(){
	
	int n,m;
	cin>>n>>m;
	vector<int> c(n);
	rep(i,m){
		c[i%n]++;
	}
	
	combi C(1000000);
	mint ans = C.kaijou[m];
	
	rep(i,n){
		ans *= C.kaijou_[c[i]];
	}
	
	cout<<ans.val()<<endl;
	
	return 0;
}
0