結果

問題 No.2111 Sum of Diff
ユーザー roarisroaris
提出日時 2022-10-28 21:35:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 325 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 112,472 KB
最終ジャッジ日時 2023-09-20 04:23:17
合計ジャッジ時間 4,384 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
75,948 KB
testcase_01 AC 99 ms
71,352 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
ans = 0
acc = 0
MOD = 998244353

for i in range(N):
    r = pow(2, N-1-i, MOD)
    add = (acc-A[i]*(pow(2, i, MOD)-1))*r%MOD
    ans += add
    ans %= MOD
    acc += pow(2, i)*A[i]
    acc %= MOD

print(ans)
0