結果

問題 No.2717 Sum of Subarray of Subsequence
ユーザー rlangevinrlangevin
提出日時 2024-04-07 14:57:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 101,804 KB
最終ジャッジ日時 2024-04-07 14:57:55
合計ジャッジ時間 3,421 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 34 ms
53,460 KB
testcase_07 AC 35 ms
53,460 KB
testcase_08 AC 34 ms
53,460 KB
testcase_09 AC 119 ms
101,720 KB
testcase_10 AC 118 ms
101,592 KB
testcase_11 AC 117 ms
101,580 KB
testcase_12 AC 116 ms
101,708 KB
testcase_13 AC 116 ms
101,604 KB
testcase_14 AC 115 ms
101,580 KB
testcase_15 AC 116 ms
101,592 KB
testcase_16 AC 116 ms
101,592 KB
testcase_17 AC 127 ms
101,592 KB
testcase_18 AC 116 ms
101,604 KB
testcase_19 AC 116 ms
101,592 KB
testcase_20 AC 37 ms
53,460 KB
testcase_21 AC 33 ms
53,460 KB
testcase_22 AC 115 ms
101,804 KB
testcase_23 AC 77 ms
100,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
mod = 998244353
two = [1] * (N + 1)
for i in range(N):
    two[i + 1] = (two[i] * 2) % mod

def f(x):
    return (two[x] + x * two[x-1]) % mod

ans = 0
for i in range(N):
    ans += A[i] * f(i) * f(N - 1 - i)
    ans %= mod

print(ans)
0