Cowdependence
시간 제한2초메모리 제한2048 MB
각 그룹이 같은 라벨로만 이루어지고 최대 x마리 범위 안에 있어야 할 때, x = 1..N 각각에 대해 최소 그룹 수를 구한다.
문제
Farmer John's cows have been arranged into a line. The th cow has label (). A group of cows can form a friendship group if they all have the same label and each cow is within cows of all the others in the group, where is an integer in the range . Every cow must be in exactly one friendship group.
For each from to , calculate the minimum number of friendship groups that could have formed.
입력
The first line consists of an integer .
The next line contains , the labels of each cow.
출력
For each from to , output the minimum number of friendship groups for that on a new line.
힌트
Here are examples of how to assign cows to friendship groups for and in a way that minimizes the number of groups. Each letter corresponds to a different group.
Example:
1 1 1 9 2 1 2 1 1
x = 1: A B B C D E F G G (7 groups)
x = 1: A A B C D E F G G (7 groups, alternative grouping)
x = 2: A A A B C D C E E (5 groups)
x = 2: A A A B C D C D E (5 groups, alternative grouping)