結果

問題 No.1325 Subsequence Score
ユーザー roarisroaris
提出日時 2020-12-22 15:08:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 673 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 172,708 KB
最終ジャッジ日時 2023-10-21 12:56:37
合計ジャッジ時間 9,646 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,436 KB
testcase_01 AC 39 ms
53,436 KB
testcase_02 AC 39 ms
53,436 KB
testcase_03 AC 47 ms
60,056 KB
testcase_04 AC 41 ms
53,436 KB
testcase_05 AC 48 ms
62,104 KB
testcase_06 AC 40 ms
53,436 KB
testcase_07 AC 47 ms
60,056 KB
testcase_08 AC 39 ms
53,436 KB
testcase_09 AC 39 ms
53,436 KB
testcase_10 AC 39 ms
53,436 KB
testcase_11 AC 40 ms
53,436 KB
testcase_12 AC 40 ms
53,436 KB
testcase_13 AC 664 ms
171,740 KB
testcase_14 AC 207 ms
96,020 KB
testcase_15 AC 559 ms
148,096 KB
testcase_16 AC 626 ms
161,364 KB
testcase_17 AC 295 ms
99,900 KB
testcase_18 AC 186 ms
93,192 KB
testcase_19 AC 669 ms
172,516 KB
testcase_20 AC 122 ms
84,080 KB
testcase_21 AC 247 ms
102,016 KB
testcase_22 AC 304 ms
101,776 KB
testcase_23 AC 673 ms
172,708 KB
testcase_24 AC 672 ms
172,708 KB
testcase_25 AC 672 ms
172,708 KB
testcase_26 AC 672 ms
172,708 KB
testcase_27 AC 672 ms
172,708 KB
testcase_28 AC 39 ms
53,436 KB
testcase_29 AC 39 ms
53,436 KB
testcase_30 AC 38 ms
53,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
ans = 0
MOD = 998244353

for i in range(N):
    if i==0:
        ans += pow(2, N-i-1, MOD)*a[i]
    else:
        ans += pow(2, i-1, MOD)*(i+2)*pow(2, N-i-1, MOD)*a[i]
        
    ans %= MOD

print(ans)
0