結果

問題 No.2111 Sum of Diff
ユーザー とりゐとりゐ
提出日時 2022-10-28 22:18:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 114,168 KB
最終ジャッジ日時 2023-09-20 05:20:15
合計ジャッジ時間 4,410 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,264 KB
testcase_01 AC 75 ms
71,236 KB
testcase_02 AC 153 ms
114,000 KB
testcase_03 AC 125 ms
108,228 KB
testcase_04 AC 88 ms
79,580 KB
testcase_05 AC 150 ms
113,968 KB
testcase_06 AC 150 ms
114,168 KB
testcase_07 AC 94 ms
85,088 KB
testcase_08 AC 103 ms
90,348 KB
testcase_09 AC 85 ms
76,684 KB
testcase_10 AC 90 ms
77,604 KB
testcase_11 AC 112 ms
97,540 KB
testcase_12 AC 114 ms
96,680 KB
testcase_13 AC 105 ms
88,144 KB
testcase_14 AC 135 ms
101,896 KB
testcase_15 AC 153 ms
113,600 KB
testcase_16 AC 110 ms
94,116 KB
testcase_17 AC 157 ms
113,988 KB
testcase_18 AC 103 ms
88,544 KB
testcase_19 AC 130 ms
101,632 KB
testcase_20 AC 153 ms
113,824 KB
testcase_21 AC 87 ms
76,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353
n=int(input())
a=list(map(int,input().split()))

pow2=[1]
for i in range(n+10):
  pow2.append(pow2[-1]*2%mod)
ans=0
for i in range(n):
  ans+=a[i]*(pow2[i])%mod*(pow2[n-1-i]-1)%mod
  ans-=a[i]*(pow2[i]-1)%mod*(pow2[n-1-i])%mod
  ans%=mod
  
print(ans)
0