結果

問題 No.2717 Sum of Subarray of Subsequence
ユーザー flygonflygon
提出日時 2024-04-05 23:27:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 114,828 KB
最終ジャッジ日時 2024-04-05 23:29:37
合計ジャッジ時間 5,822 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
75,752 KB
testcase_01 AC 138 ms
75,752 KB
testcase_02 AC 137 ms
75,752 KB
testcase_03 AC 139 ms
75,752 KB
testcase_04 AC 138 ms
75,752 KB
testcase_05 AC 140 ms
75,752 KB
testcase_06 AC 137 ms
75,752 KB
testcase_07 AC 138 ms
75,752 KB
testcase_08 AC 141 ms
75,752 KB
testcase_09 AC 192 ms
112,872 KB
testcase_10 AC 193 ms
112,880 KB
testcase_11 AC 189 ms
112,864 KB
testcase_12 AC 188 ms
112,872 KB
testcase_13 AC 191 ms
112,904 KB
testcase_14 AC 189 ms
112,868 KB
testcase_15 AC 190 ms
112,888 KB
testcase_16 AC 190 ms
112,872 KB
testcase_17 AC 190 ms
112,888 KB
testcase_18 AC 191 ms
112,892 KB
testcase_19 AC 195 ms
112,888 KB
testcase_20 AC 139 ms
75,752 KB
testcase_21 AC 138 ms
75,752 KB
testcase_22 AC 192 ms
114,828 KB
testcase_23 AC 174 ms
114,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n = int(input())
a = list(map(int,input().split()))
mod= 998244353
x = [1,3]
for i in range(2,202020):
    x.append(x[-1]*2+pow(2,i-1, mod))
    x[-1] %= mod
ans = 0
for i in range(n):
    l = i
    r = n-i-1
    tmp = x[l] * x[r]
    tmp %= mod
    ans += tmp*a[i]
    ans %= mod

print(ans)
0