結果

問題 No.2111 Sum of Diff
ユーザー ikomaikoma
提出日時 2022-10-28 21:54:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 113,820 KB
最終ジャッジ日時 2023-09-20 04:49:17
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,252 KB
testcase_01 AC 74 ms
71,152 KB
testcase_02 AC 138 ms
113,404 KB
testcase_03 AC 113 ms
106,836 KB
testcase_04 AC 81 ms
79,368 KB
testcase_05 AC 135 ms
113,820 KB
testcase_06 AC 132 ms
113,564 KB
testcase_07 AC 86 ms
84,564 KB
testcase_08 AC 91 ms
89,384 KB
testcase_09 AC 76 ms
76,260 KB
testcase_10 AC 78 ms
77,264 KB
testcase_11 AC 98 ms
96,548 KB
testcase_12 AC 97 ms
95,644 KB
testcase_13 AC 90 ms
87,512 KB
testcase_14 AC 115 ms
100,432 KB
testcase_15 AC 133 ms
113,480 KB
testcase_16 AC 95 ms
93,156 KB
testcase_17 AC 133 ms
113,624 KB
testcase_18 AC 90 ms
87,660 KB
testcase_19 AC 114 ms
100,204 KB
testcase_20 AC 133 ms
113,424 KB
testcase_21 AC 76 ms
76,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

pw=[0]
p=1
for i in range(N-1):
    p<<=1
    p%=MOD
    pw.append(p-1)

ans=0
for i in range(N):
    ans += A[i] * (pw[N-i-1] - pw[i]) % MOD
    ans %= MOD
print(ans)
0