結果

問題 No.2111 Sum of Diff
ユーザー タコイモタコイモ
提出日時 2022-10-28 22:13:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 103,372 KB
最終ジャッジ日時 2023-09-20 05:13:53
合計ジャッジ時間 4,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,208 KB
testcase_01 AC 76 ms
71,400 KB
testcase_02 AC 137 ms
101,452 KB
testcase_03 AC 118 ms
99,480 KB
testcase_04 AC 88 ms
78,868 KB
testcase_05 AC 140 ms
101,736 KB
testcase_06 AC 142 ms
101,892 KB
testcase_07 AC 93 ms
82,792 KB
testcase_08 AC 94 ms
86,496 KB
testcase_09 AC 83 ms
76,408 KB
testcase_10 AC 85 ms
77,380 KB
testcase_11 AC 104 ms
91,904 KB
testcase_12 AC 104 ms
91,728 KB
testcase_13 AC 94 ms
85,132 KB
testcase_14 AC 122 ms
103,372 KB
testcase_15 AC 135 ms
101,188 KB
testcase_16 AC 101 ms
89,860 KB
testcase_17 AC 136 ms
101,520 KB
testcase_18 AC 95 ms
85,188 KB
testcase_19 AC 117 ms
102,940 KB
testcase_20 AC 139 ms
101,520 KB
testcase_21 AC 83 ms
76,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int,input().split()))
mod = 998244353
n2 = [0]*(N+1)
n2[0] = 1
ans =0
for i in range(1,N+1):
  n2[i] = (2*n2[i-1])%mod

for i in range(N):
  ai = a[i]
  ans = (ans-ai*(n2[i]-1)+ai*(n2[N-i-1]-1))%mod
print(ans)

  
0