結果
問題 | No.2717 Sum of Subarray of Subsequence |
ユーザー |
![]() |
提出日時 | 2024-04-05 23:02:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,234 ms / 2,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 334 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 103,748 KB |
最終ジャッジ日時 | 2024-10-01 03:00:13 |
合計ジャッジ時間 | 17,967 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
N=int(input())A=list(map(int,input().split()))p=998244353def exp(a,b,p):ans,mul,div=1,a,1for i in range(70):if b//div%2==1:ans*=mulans%=pmul=mul**2%pdiv*=2return ans%pleft=[1]l=0for i in range(1,N+10):left.append((1+i*exp(2,i-1,p)+exp(2,i,p)-1)%p)l=left[-1]ans=0for i in range(N):ans+=A[i]*left[i]*left[N-1-i]%pprint(ans%p)