結果

問題 No.2111 Sum of Diff
ユーザー ShirotsumeShirotsume
提出日時 2022-10-28 21:55:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 101,636 KB
最終ジャッジ日時 2023-09-20 04:51:07
合計ジャッジ時間 7,781 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,240 KB
testcase_01 AC 79 ms
71,256 KB
testcase_02 AC 481 ms
100,252 KB
testcase_03 AC 325 ms
99,140 KB
testcase_04 AC 128 ms
78,656 KB
testcase_05 AC 474 ms
100,412 KB
testcase_06 AC 478 ms
100,356 KB
testcase_07 AC 169 ms
82,752 KB
testcase_08 AC 201 ms
85,976 KB
testcase_09 AC 104 ms
76,424 KB
testcase_10 AC 113 ms
77,332 KB
testcase_11 AC 255 ms
91,140 KB
testcase_12 AC 252 ms
90,960 KB
testcase_13 AC 190 ms
84,788 KB
testcase_14 AC 398 ms
101,408 KB
testcase_15 AC 476 ms
100,044 KB
testcase_16 AC 241 ms
89,336 KB
testcase_17 AC 474 ms
100,468 KB
testcase_18 AC 187 ms
84,744 KB
testcase_19 AC 373 ms
101,636 KB
testcase_20 AC 478 ms
100,292 KB
testcase_21 AC 93 ms
76,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n = ii()

a = li()
ans = 0
for i in range(n):
    ans -= (pow(2, n - 1, mod) - pow(2, n - i - 1, mod)) * a[i]
    ans %= mod
    ans += (pow(2, n - 1, mod) - pow(2, i, mod)) * a[i]
    ans %= mod

print(ans)
0