結果

問題 No.1325 Subsequence Score
ユーザー
提出日時 2020-12-22 02:33:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 781 ms
コンパイル使用メモリ 91,584 KB
実行使用メモリ 7,356 KB
最終ジャッジ日時 2024-09-21 13:39:46
合計ジャッジ時間 4,184 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#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];
	}
	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;
}
0