結果

問題 No.2817 Competition
ユーザー highlighter
提出日時 2024-07-14 00:00:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 4,015 ms
コンパイル使用メモリ 183,588 KB
実行使用メモリ 14,336 KB
最終ジャッジ日時 2024-07-14 00:00:11
合計ジャッジ時間 8,917 ms
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<atcoder/all>
int main(){
	int N;
	scanf("%d",&N);
	std::queue<std::vector<atcoder::modint998244353>> poly;
	for(long long A,i=0;i<N;i++){
		scanf("%lld",&A);
		poly.push({1,A});
	}
	while(poly.size()>1){
	    std::vector<atcoder::modint998244353> bef=move(poly.front());
	    poly.pop();
	    poly.push(atcoder::convolution(bef,poly.front()));
	    poly.pop();
	}
	atcoder::modint998244353 ans=0;
	for(int i=0; i<=N; i++)ans+=(atcoder::modint998244353(i).pow(N-i))*poly.front()[i];
	printf("%d\n",ans.val());
}
0