結果
問題 | No.2717 Sum of Subarray of Subsequence |
ユーザー |
|
提出日時 | 2024-04-05 21:33:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 4,223 ms |
コンパイル使用メモリ | 250,896 KB |
最終ジャッジ日時 | 2025-02-20 20:56:36 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#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;}