結果

問題 No.1100 Boxes
ユーザー 沙耶花沙耶花
提出日時 2023-01-25 14:31:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 1,273 bytes
コンパイル時間 4,998 ms
コンパイル使用メモリ 271,856 KB
実行使用メモリ 14,504 KB
最終ジャッジ日時 2023-09-09 02:06:06
合計ジャッジ時間 8,481 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
11,468 KB
testcase_01 AC 21 ms
11,528 KB
testcase_02 AC 21 ms
11,472 KB
testcase_03 AC 21 ms
11,472 KB
testcase_04 AC 21 ms
11,464 KB
testcase_05 AC 21 ms
11,456 KB
testcase_06 AC 21 ms
11,664 KB
testcase_07 AC 21 ms
11,468 KB
testcase_08 AC 21 ms
11,788 KB
testcase_09 AC 21 ms
11,464 KB
testcase_10 AC 21 ms
11,472 KB
testcase_11 AC 21 ms
11,528 KB
testcase_12 AC 21 ms
11,528 KB
testcase_13 AC 21 ms
11,668 KB
testcase_14 AC 21 ms
11,476 KB
testcase_15 AC 21 ms
11,592 KB
testcase_16 AC 21 ms
11,460 KB
testcase_17 AC 21 ms
11,500 KB
testcase_18 AC 21 ms
11,496 KB
testcase_19 AC 22 ms
11,588 KB
testcase_20 AC 23 ms
11,876 KB
testcase_21 AC 33 ms
12,856 KB
testcase_22 AC 45 ms
14,276 KB
testcase_23 AC 33 ms
12,868 KB
testcase_24 AC 34 ms
12,880 KB
testcase_25 AC 35 ms
12,868 KB
testcase_26 AC 49 ms
14,424 KB
testcase_27 AC 47 ms
14,044 KB
testcase_28 AC 28 ms
12,176 KB
testcase_29 AC 48 ms
14,212 KB
testcase_30 AC 47 ms
14,156 KB
testcase_31 AC 29 ms
12,392 KB
testcase_32 AC 38 ms
13,060 KB
testcase_33 AC 51 ms
14,448 KB
testcase_34 AC 52 ms
14,460 KB
testcase_35 AC 21 ms
11,584 KB
testcase_36 AC 41 ms
14,332 KB
testcase_37 AC 21 ms
11,464 KB
testcase_38 AC 34 ms
12,932 KB
testcase_39 AC 50 ms
14,504 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 1000000000000000001

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);
	}
	
};





combi C(1000000);


int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<mint> t(K+1,0);
	vector<mint> x(K+1,0);
	rep(i,K+1){
		t[i] = mint(i).pow(N);
		t[i] *= C.kaijou_[i];
		x[i] = C.kaijou_[i];
		if(i%2==1)x[i] *= -1;
	}
	t = convolution(t,x);
	rep(i,t.size())t[i] *= C.kaijou[i];
	mint ans = 0;
	
	for(int i=1;i<=K;i++){
		if((K-i)%2==0)continue;
		ans += t[i] * C.combination(K,i);
	}
	
	cout<<ans.val()<<endl;
	
	return 0;
}
0