結果

問題 No.1325 Subsequence Score
ユーザー 夜
提出日時 2020-12-22 02:36:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 92,060 KB
実行使用メモリ 7,516 KB
最終ジャッジ日時 2023-10-21 12:22:48
合計ジャッジ時間 4,626 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 219 ms
7,456 KB
testcase_14 AC 64 ms
6,328 KB
testcase_15 AC 184 ms
6,836 KB
testcase_16 AC 210 ms
7,264 KB
testcase_17 AC 93 ms
6,328 KB
testcase_18 AC 55 ms
6,328 KB
testcase_19 AC 221 ms
7,504 KB
testcase_20 AC 31 ms
4,348 KB
testcase_21 AC 77 ms
6,328 KB
testcase_22 AC 95 ms
6,328 KB
testcase_23 AC 222 ms
7,516 KB
testcase_24 AC 224 ms
7,516 KB
testcase_25 AC 223 ms
7,516 KB
testcase_26 AC 222 ms
7,516 KB
testcase_27 AC 223 ms
7,516 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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