結果

問題 No.2111 Sum of Diff
ユーザー publflpublfl
提出日時 2022-10-28 21:41:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 31,252 KB
実行使用メモリ 7,672 KB
最終ジャッジ日時 2023-09-20 04:33:09
合計ジャッジ時間 2,657 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,592 KB
testcase_01 AC 3 ms
5,556 KB
testcase_02 AC 31 ms
7,620 KB
testcase_03 AC 22 ms
7,128 KB
testcase_04 AC 7 ms
6,048 KB
testcase_05 AC 31 ms
7,616 KB
testcase_06 AC 31 ms
7,544 KB
testcase_07 AC 10 ms
6,368 KB
testcase_08 AC 12 ms
6,500 KB
testcase_09 AC 5 ms
5,808 KB
testcase_10 AC 5 ms
5,932 KB
testcase_11 AC 17 ms
6,852 KB
testcase_12 AC 17 ms
6,756 KB
testcase_13 AC 12 ms
6,548 KB
testcase_14 AC 26 ms
7,324 KB
testcase_15 AC 30 ms
7,612 KB
testcase_16 AC 15 ms
6,688 KB
testcase_17 AC 31 ms
7,672 KB
testcase_18 AC 12 ms
6,540 KB
testcase_19 AC 24 ms
7,284 KB
testcase_20 AC 31 ms
7,672 KB
testcase_21 AC 4 ms
5,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define MOD 998244353

long long int power[200010],x[200010],y[200010];
int main()
{
	power[0] = 1;
	for(int i=1;i<=200000;i++) power[i] = (2*power[i-1])%MOD;
	
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%lld",&x[i]);
	for(int i=1;i<=a;i++)
	{
		y[i] = power[a-i] - power[i-1] + MOD;
		y[i] %= MOD;
	}
	long long int ans = 0;
	for(int i=1;i<=a;i++) ans += (y[i]*x[i]), ans %= MOD;
	printf("%lld",ans);
}
0