結果
問題 | No.2717 Sum of Subarray of Subsequence |
ユーザー |
|
提出日時 | 2024-04-05 22:04:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 192 ms / 2,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 4,292 ms |
コンパイル使用メモリ | 251,920 KB |
最終ジャッジ日時 | 2025-02-20 21:23:59 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using mint = modint998244353;int main () {int N;cin >> N;mint ans = 0;auto f = [](int i) -> mint {mint b = 2;mint r = b.pow(i);if (i) {r += b.pow(i - 1) * i;}return r;};for (int i = 0; i < N; i ++) {int a;cin >> a;mint x = a;x *= f(i);x *= f(N - i - 1);ans += x;}cout << ans.val() << endl;}