logo AlgoBeat OnlineJudge
登录 注册

#209358. [ICPC 2020 Shanghai R] Fountains

内存限制:1024 MiB 时间限制:6000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Suppose you and your teammate Mixsx will attend the Namomo Camp. The Namomo Camp will happen in consecutive days. We name the -th day as day (). The cost of day is .

Unfortunately, the schedule of the Namomo Camp conflicts with Mixsx's final exams. Mixsx has final exams every day between day and day . The exact value of and have not been announced by his college so we assume that every pair of integers and satisfying will be chosen with probability . He decides to take all the exams and thus be absent from the Namomo Camp from day to day . His will be in this case.

As Mixsx's teammate, you want Mixsx to give up his final exams and come back to the Namomo Camp. You can prepare plans before and are announced. In the -th plan (), you shut the electricity off to his college every day from day to day . You can choose the values of and as long as they are two integers satisfying .

Once and are announced, you can choose a plan () such that . Then Mixsx will come back to the Namomo Camp on every day from day to day . His loss becomes in this case. You will choose a plan that minimizes Mixsx's loss. If no plan satisfies , Mixsx will attend his final exams normally and his loss is .

Please calculate the minimum possible expected loss of Mixsx if you choose the plans optimally. Output for every from to .

Formally, given a list of numbers , define a loss function . Given an integer (), you should select integers satisfying for all , such that

is minimized. ( is defined as if no satisfies and .) Output the minimized value for every integer in .

输入格式

The first line contains an integer . The second line contains space separated integers .

输出格式

The output contains integers in their own lines, the expectations when multiplied by . It can be shown that the results are always integers.

样例

样例输入 1

1
1

样例输出 1

0

样例输入 2

2
13 24

样例输出 2

26
13
0

样例输入 3

3
6 4 7

样例输出 3

33
21
12
8
4
0

数据范围与提示

For the first test case, we only need to consider the case . We can only choose . Then the expected loss is and the result is .

For the third test case, consider the case when . We choose , and . The expected loss is . And the result is .