AtCoder Regular Contest 120
A
Max Add
AtCoder
⌀ 183
原题
←B →
翻译中…

Problem Statement

翻译中…

For a sequence $a = (a_1, a_2, a_3, \dots, a_k)$, let $f(a)$ be the sum of its elements after the following is done:

翻译中…
  • For each $i = 1, 2, 3, \dots, k$, in this order, do the following operation: add the current maximum value of an element in $a$ to $a_i$.
翻译中…

You are given a sequence of length $N$: $A = (A_1, A_2, A_3, \dots, A_N)$. For each integer $k$ between $1$ and $N$ (inclusive), find $f(a)$ when $a = (A_1, A_2, A_3, \dots, A_k)$.

翻译中…

Constraints

翻译中…
  • $1 \le N \le 2 \times 10^5$
  • $1 \le A_i \le 10^7$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 A_3 \dots A_N

翻译中…

Output

翻译中…

Print $N$ lines. The $k$-th line should contain $f(a)$ when $a = (A_1, A_2, A_3, \dots, A_k)$.

翻译中…

样例

Input #1
3
1 2 3
Output #1
2
8
19
For example, when $a = (A_1, A_2, A_3)$, $f(a)$ is computed as follows: - First, for $i = 1$, add to $a_1$ the current maximum value of $a$, which is $3$, making $a = (4, 2, 3)$. - Next, for $i = 2$, add to $a_2$ the current maximum value of $a$, which is $4$, making $a = (4, 6, 3)$. - Finally, for $i = 3$, add to $a_3$ the current maximum value of $a$, which is $6$, making $a = (4, 6, 9)$. - $f(a)$ is the sum of the elements of $a$ now, which is $19$.
题目信息
题号
arc120_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。