Perfect Groups

题意翻译

对于一个长度为$len$的序列 它的答案定义为**最小划分的组数**(以使得每个组中的数两两乘积为平方数) 给你一个长度为$n$($1\leq n \leq 5000$)的数组$a[i](-10^8 \leq a[i] \leq 10^8)$ 对于其所有的子串 第$k$个输出的数是答案为$k$的子串的数量

题目描述

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).

输入输出格式

输入格式


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 $ 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 $ .

输入输出样例

输入样例 #1

2
5 5

输出样例 #1

3 0

输入样例 #2

5
5 -4 2 1 8

输出样例 #2

5 5 3 2 0

输入样例 #3

1
0

输出样例 #3

1