結果

問題 No.1325 Subsequence Score
ユーザー startcppstartcpp
提出日時 2020-12-22 00:50:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 805 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 63,848 KB
実行使用メモリ 7,588 KB
最終ジャッジ日時 2023-10-21 12:17:30
合計ジャッジ時間 2,761 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 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 72 ms
7,532 KB
testcase_14 AC 23 ms
6,404 KB
testcase_15 AC 61 ms
6,912 KB
testcase_16 AC 69 ms
7,340 KB
testcase_17 AC 31 ms
6,404 KB
testcase_18 AC 20 ms
6,404 KB
testcase_19 AC 74 ms
7,580 KB
testcase_20 AC 11 ms
4,348 KB
testcase_21 AC 27 ms
6,404 KB
testcase_22 AC 32 ms
6,404 KB
testcase_23 AC 73 ms
7,588 KB
testcase_24 AC 74 ms
7,588 KB
testcase_25 AC 73 ms
7,588 KB
testcase_26 AC 73 ms
7,588 KB
testcase_27 AC 74 ms
7,588 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//これすき。Σbiだったらa_iを選ぶ確率、今回は期待番号(prefixの個数期待値)!
//最近のyukicoderを知らないのでアレだけど、☆2.5くらいな気がする。。
//(手ごたえは、AtCoder 500点くらいかなあ)
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;

int n;
int a[500000];

signed main() {
	int i;
	
	scanf("%lld", &n);
	for (i = 0; i < n; i++) scanf("%lld", a + i);
	
	//2^n * 1/2 * (1+0.5*i) * a[i]
	//2^(n - 2) * (2 + i) * a[i]
	if (n == 1) {
		cout << a[0] << endl;
		return 0;
	}
	
	int mod = 998244353;
	int p2 = 1;
	for (i = 0; i < n - 2; i++) {
		p2 *= 2;
		p2 %= mod;
	}
	
	int su = 0;
	for (i = 0; i < n; i++) {
		su += (2 + i) * a[i];
		su %= mod;
	}
	
	cout << (p2 * su) % mod << endl;
	return 0;
}
0