結果

問題 No.1325 Subsequence Score
ユーザー merom686
提出日時 2020-12-22 01:38:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 89,328 KB
最終ジャッジ日時 2025-01-17 06:01:04
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    ll r, t = 1;
    cin >> r;

    for (int i = 1; i < n; i++) {
        int a;
        cin >> a;

        r *= 2;
        r += ((i + 2) * t) % P * a;
        r %= P;

        t *= 2;
        if (t >= P) t -= P;
    }

    cout << r << endl;

    return 0;
}
0