結果

問題 No.2111 Sum of Diff
ユーザー 遭難者遭難者
提出日時 2022-10-28 22:58:23
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 9,096 ms
コンパイル使用メモリ 151,488 KB
実行使用メモリ 4,740 KB
最終ジャッジ日時 2023-09-20 06:10:45
合計ジャッジ時間 13,380 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 82 ms
4,736 KB
testcase_03 AC 56 ms
4,376 KB
testcase_04 AC 13 ms
4,376 KB
testcase_05 AC 82 ms
4,688 KB
testcase_06 AC 81 ms
4,736 KB
testcase_07 AC 21 ms
4,380 KB
testcase_08 AC 29 ms
4,380 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 9 ms
4,376 KB
testcase_11 AC 40 ms
4,376 KB
testcase_12 AC 39 ms
4,376 KB
testcase_13 AC 26 ms
4,380 KB
testcase_14 AC 67 ms
4,592 KB
testcase_15 AC 78 ms
4,688 KB
testcase_16 AC 34 ms
4,376 KB
testcase_17 AC 81 ms
4,684 KB
testcase_18 AC 27 ms
4,380 KB
testcase_19 AC 63 ms
4,380 KB
testcase_20 AC 81 ms
4,740 KB
testcase_21 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace atcoder;
using namespace std;
#define mint modint998244353
int main()
{
    int n;
    cin >> n;
    vector<mint> a(n);
    rep(i, n)
    {
        int x;
        cin >> x;
        a[i] = x;
    }
    vector<mint> t(n);
    t[0] = 1;
    for (int i = 1; i < n; i++)
        t[i] = 2 * t[i - 1];
    mint ans = 0;
    rep(i, n) ans += (t[n - 1 - i] - t[i]) * a[i];
    cout << ans.val() << endl;
    return 0;
}
0