結果

問題 No.1325 Subsequence Score
コンテスト
ユーザー LyricalMaestro
提出日時 2025-10-14 01:17:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 154,424 KB
最終ジャッジ日時 2025-10-14 01:17:12
合計ジャッジ時間 4,969 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

## https://yukicoder.me/problems/no/1325

MOD = 998244353

def main():
    N = int(input())
    A = list(map(int, input().split()))

    answer = 0
    pow1 = pow(2, N - 1, MOD)
    pow2 = pow(2, N - 2, MOD)
    for i in range(N):
        a2 = (A[i] * pow1) % MOD

        a1 = (A[i] * i) % MOD
        a1 *= pow2
        a1 %= MOD

        a = a1 + a2
        a %= MOD
        answer += a
        answer %=MOD

    print(answer)






        

    



if __name__ == "__main__":
    main()
0