Cowdependence
Time limit2sMemory limit2048 MB
For each x from 1 to N, find the fewest groups of same-label cows where every two cows in a group are at most x positions apart.
Problem
Farmer John has cows arranged in a line. The th cow has label (). A group of cows can form a friendship group if all cows in the group have the same label and each cow is within cows of every other cow in the group, where is an integer in the range . Every cow must belong to exactly one friendship group.
For each from to , compute the minimum number of friendship groups that can be formed.
Input
The first line contains an integer .
The next line contains the labels of the cows.
Output
For each from to , output the minimum number of friendship groups for that on a new line.
Hint
In the sample, the labels need 7 groups when and 5 groups when .