結果

問題 No.2966 Simple Plus Minus Problem
ユーザー 沙耶花
提出日時 2024-11-16 16:10:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 275 ms / 2,567 ms
コード長 798 bytes
コンパイル時間 4,674 ms
コンパイル使用メモリ 257,932 KB
最終ジャッジ日時 2025-02-25 04:32:32
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

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 1000000000000000000LL

int main(){
	int N,K;
	cin>>N>>K;
	vector<mint> t(N+1);
	t[0] = 1;
	{
		int tk = (K)/2;
		mint tt = 1;
		for(int i=1;i<=N;i++){
			tt *= tk+i-1;
			tt /= i;
			t[i] = tt;
		}
	
	}
	vector<mint> a(N);
	rep(i,N){
		int tt;
		cin>>tt;a[i] = tt;
	}
	a = convolution(a,t);
	{
		int tk = (K+1)/2;
		mint tt = 1;
		for(int i=1;i<=N;i++){
			tt *= tk+i-1;
			tt /= i;
			t[i] = tt;
			if(i%2==1)t[i] *= -1;
		}
	
	}
	a = convolution(a,t);
	rep(i,N){
		if(i%2==1 && K%2==1)a[i] *= -1;
		if(i!=0)cout<<' ';
		cout<<a[i].val();
	}
	cout<<endl;
	return 0;
}
0