結果
| 問題 | 
                            No.2550 MORE! JUMP! MORE!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-09-18 00:30:54 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 26 ms / 2,000 ms | 
| コード長 | 474 bytes | 
| コンパイル時間 | 1,747 ms | 
| コンパイル使用メモリ | 194,308 KB | 
| 最終ジャッジ日時 | 2025-02-24 09:11:51 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 40 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N,mod=998244353;;
    cin>>N;
    vector<ll> A(N),P(N+1,1);
    for(int i=0;i<N;i++){
        cin>>A[i];
        P[i+1]=(P[i]*2)%mod;
    }
    ll an=0;
    for(int i=0;i<N;i++){
        ll res=A[i]*(i*P[i-1]%mod+P[i]);
        res%=mod;
        if(i<N-1)res=(res*P[N-i-2])%mod;
        an+=res;
    }
    cout<<an%mod<<endl;
}