結果
問題 | No.1325 Subsequence Score |
ユーザー |
|
提出日時 | 2020-12-22 02:36:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 227 ms / 2,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 843 ms |
コンパイル使用メモリ | 93,580 KB |
実行使用メモリ | 7,544 KB |
最終ジャッジ日時 | 2024-09-21 13:40:24 |
合計ジャッジ時間 | 4,551 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <iostream>#include <string>#include <algorithm>#include <vector>#include <iomanip>#include <cmath>#include <stdio.h>#include <queue>#include <deque>#include <cstdio>#include <set>#include <map>#include <bitset>#include <stack>#include <cctype>using namespace std;long long a[500050];long long mod = 998244353;int main() {long long n;cin >> n;for (int i = 0; i < n; i++) {cin >> a[i];}if (n == 1) {cout << a[0] % mod << endl;return 0;}long long t = 1;for (int i = 0; i < n - 2; i++) {t *= 2;t %= mod;}long long ans = 0, t1 = t;for (int i = 0; i < n; i++) {t1 += t;t1 %= mod;ans += t1 * a[i] % mod;ans %= mod;}cout << ans << endl;}