AtCoder Grand Contest 003
翻译中…
Problem Statement
翻译中…
Snuke got an integer sequence from his mother, as a birthday present. The sequence has $N$ elements, and the $i$-th of them is $i$. Snuke performs the following $Q$ operations on this sequence. The $i$-th operation, described by a parameter $q_i$, is as follows:
翻译中…
- Take the first
$q_i$elements from the sequence obtained by concatenating infinitely many copy of the current sequence, then replace the current sequence with those$q_i$elements.
翻译中…
After these $Q$ operations, find how many times each of the integers $1$ through $N$ appears in the final sequence.
翻译中…
Constraints
翻译中…
$1 ≦ N ≦ 10^5$$0 ≦ Q ≦ 10^5$$1 ≦ q_i ≦ 10^{18}$- All input values are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N Q
q_1
:
q_Q
翻译中…
Output
翻译中…
Print $N$ lines. The $i$-th line $(1 ≦ i ≦ N)$ should contain the number of times integer $i$ appears in the final sequence after the $Q$ operations.
翻译中…
样例
Input #1
5 3
6
4
11
Output #1
3
3
3
2
0
After the first operation, the sequence becomes: $1,2,3,4,5,1$.
After the second operation, the sequence becomes: $1,2,3,4$.
After the third operation, the sequence becomes: $1,2,3,4,1,2,3,4,1,2,3$.
In this sequence, integers $1,2,3,4,5$ appear $3,3,3,2,0$ times, respectively.
Input #2
10 10
9
13
18
8
10
10
9
19
22
27
Output #2
7
4
4
3
3
2
2
2
0
0
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。