Codeforces Round 480 (Div. 2)
D
Perfect Groups
Codeforces
2100
原题
← CE →
翻译中…

SaMer has written the greatest test case of all time for one of his problems. For a given array of integers, the problem asks to find the minimum number of groups the array can be divided into, such that the product of any pair of integers in the same group is a perfect square.

翻译中…

Each integer must be in exactly one group. However, integers in a group do not necessarily have to be contiguous in the array.

翻译中…

SaMer wishes to create more cases from the test case he already has. His test case has an array $A$ of $n$ integers, and he needs to find the number of contiguous subarrays of $A$ that have an answer to the problem equal to $k$ for each integer $k$ between $1$ and $n$ (inclusive).

翻译中…

Input

翻译中…

The first line of input contains a single integer $n$ ($1 \leq n \leq 5000$), the size of the array.

翻译中…

The second line contains $n$ integers $a_1$,$a_2$,$\dots$,$a_n$ ($-10^8 \leq a_i \leq 10^8$), the values of the array.

翻译中…

Output

翻译中…

Output $n$ space-separated integers, the $k$-th integer should be the number of contiguous subarrays of $A$ that have an answer to the problem equal to $k$.

翻译中…

样例

Input #1
2
5 5
Output #1
3 0
InputCopy OutputCopy
Input #2
5
5 -4 2 1 8
Output #2
5 5 3 2 0
InputCopy OutputCopy
Input #3
1
0
Output #3
1
InputCopy OutputCopy
题目信息
题号
980D
时间限制
1 s
内存限制
256 MB
标签
动态规划
数学
数论

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