結果

問題 No.2717 Sum of Subarray of Subsequence
ユーザー hiryuNhiryuN
提出日時 2024-04-05 22:26:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 572 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 104,116 KB
最終ジャッジ日時 2024-04-05 22:27:06
合計ジャッジ時間 9,120 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 35 ms
53,332 KB
testcase_02 AC 36 ms
53,332 KB
testcase_03 AC 37 ms
53,332 KB
testcase_04 AC 36 ms
53,332 KB
testcase_05 AC 38 ms
53,332 KB
testcase_06 AC 38 ms
53,332 KB
testcase_07 AC 38 ms
53,332 KB
testcase_08 AC 35 ms
53,332 KB
testcase_09 AC 551 ms
101,588 KB
testcase_10 AC 540 ms
101,588 KB
testcase_11 AC 564 ms
101,576 KB
testcase_12 AC 540 ms
101,576 KB
testcase_13 AC 572 ms
101,728 KB
testcase_14 AC 543 ms
101,704 KB
testcase_15 AC 564 ms
101,588 KB
testcase_16 AC 541 ms
101,588 KB
testcase_17 AC 569 ms
101,588 KB
testcase_18 AC 541 ms
101,600 KB
testcase_19 AC 547 ms
101,588 KB
testcase_20 AC 38 ms
53,332 KB
testcase_21 AC 37 ms
53,332 KB
testcase_22 AC 537 ms
101,800 KB
testcase_23 AC 532 ms
104,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
M=998244353
A=list(map(int,input().split()))
ans=0
for i in range(n):
    j=n-i-1
    a=pow(2,i,M)
    a*=i
    a*=pow(2,-1,M)
    a+=pow(2,i,M)
    b=pow(2,j,M)
    b*=j
    b*=pow(2,-1,M)
    b+=pow(2,j,M)
    c=(a*b)%M
    #print(c)
    ans+=(A[i]*c)%M
print(ans%M)
0