結果

問題 No.2111 Sum of Diff
ユーザー ああいいああいい
提出日時 2022-10-31 10:51:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 102,028 KB
最終ジャッジ日時 2023-09-22 08:49:35
合計ジャッジ時間 7,711 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,408 KB
testcase_01 AC 71 ms
71,332 KB
testcase_02 AC 373 ms
100,576 KB
testcase_03 AC 267 ms
98,792 KB
testcase_04 AC 110 ms
78,812 KB
testcase_05 AC 370 ms
100,636 KB
testcase_06 AC 371 ms
100,508 KB
testcase_07 AC 140 ms
82,480 KB
testcase_08 AC 163 ms
86,228 KB
testcase_09 AC 90 ms
76,548 KB
testcase_10 AC 100 ms
77,664 KB
testcase_11 AC 206 ms
91,184 KB
testcase_12 AC 203 ms
91,184 KB
testcase_13 AC 155 ms
84,916 KB
testcase_14 AC 311 ms
101,396 KB
testcase_15 AC 363 ms
99,984 KB
testcase_16 AC 188 ms
89,448 KB
testcase_17 AC 376 ms
100,260 KB
testcase_18 AC 158 ms
84,916 KB
testcase_19 AC 293 ms
102,028 KB
testcase_20 AC 379 ms
100,260 KB
testcase_21 AC 82 ms
76,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int,input().split()))

P = 998244353
ans = 0
sub = a[0]
for i in range(1,N):
    tmp = a[i] * (pow(2,i,P)-1) % P
    ans += pow(2,N - i - 1,P) * (tmp - sub) % P
    sub += a[i] * pow(2,i,P)
    sub %= P
    ans %= P
    #print(ans,sub)
print((-ans)%P)
0