#652
Unrated
Merging Cells
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Note: The memory limit for this problem is 512MB, twice the default.

Bessie is having fun playing a famous online game, where there are a bunch of cells of different labels and sizes. Cells get eaten by other cells until only one winner remains.

There are NN (2N50002\le N\le 5000) cells in a row labeled 1N1\dots N from left to right, with initial sizes s1,s2,,sNs_1,s_2,\dots,s_N (1si1051\le s_i\le 10^5). While there is more than one cell, a pair of adjacent cells is selected uniformly at random and merged into a single new cell according to the following rule:

If a cell with label aa and current size cac_a is merged with a cell with label bb and current size cbc_b, the resulting cell has size ca+cbc_a+c_b and label equal to that of the larger cell, breaking ties by larger label. Formally, the label of the resulting cell is {aca>cbbca<cbmax(a,b)ca=cb.\begin{cases} a & c_a > c_b \\ b & c_a < c_b \\ \max(a,b) & c_a = c_b \end{cases}.

For each label ii in the range 1N1\dots N, the probability that the final cell has label ii can be expressed in the form aibi\frac{a_i}{b_i} where bi≢0(mod109+7)b_i\not\equiv 0\pmod{10^9+7}. Output aibi1(mod109+7)a_ib_i^{-1}\pmod{10^9+7}.

입력

The first line contains NN.

The next line contains s1,s2,,sNs_1,s_2,\dots, s_N.

출력

The probability of the final cell having label ii modulo 109+710^9+7 for each ii in 1N1\dots N on separate lines.

예제 입력 1

3
1 1 1

예제 출력 1

0
500000004
500000004

예제 입력 2

4
3 1 1 1

예제 출력 2

666666672
0
166666668
166666668

점수

Input 3: N8N\le 8Inputs 4-8: N100N\le 100Inputs 9-14: N500N\le 500Inputs 15-22: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.