結果

問題 No.2111 Sum of Diff
ユーザー first_vilfirst_vil
提出日時 2022-08-23 22:59:40
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 639 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 109,084 KB
最終ジャッジ日時 2024-04-19 13:12:10
合計ジャッジ時間 4,768 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
59,408 KB
testcase_01 AC 34 ms
52,336 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

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
# mod = int(1e9 + 7)
mod = 998244353

n = ii()
a = li()

p = 0
m = 0
for i in range(n):
    if 0 < i:
        m += a[i] * (pow(2, i) - 1)
        m %= mod
    if i + 1 < n:
        p += a[i] * (pow(2, n - 1 - i) - 1)
        p %= mod

print((p - m + mod) % mod)
0