結果

問題 No.2717 Sum of Subarray of Subsequence
コンテスト
ユーザー kaichou243
提出日時 2024-04-05 21:33:14
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,538 ms
コンパイル使用メモリ 253,584 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-14 19:48:50
合計ジャッジ時間 5,918 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using mint=modint998244353;
using ll=long long;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin>>n;
	vector<ll> a(n);
	for(int i=0;i<n;i++) cin>>a[i];
	mint ans=0;
	auto f=[&](int t)->mint{
		mint ret=mint(2).pow(t);
		if(t>0) ret+=mint(t)*mint(2).pow(t-1);
		return ret;
	};
	for(int i=0;i<n;i++){
		ans+=mint(a[i])*f(i)*f(n-i-1);
	}
	cout<<ans.val()<<endl;
}
0