100 atcoder#ABC210C. [ABC210C] Colorful Candies
[ABC210C] Colorful Candies
Score : points
Problem Statement
There are candies arranged in a row from left to right. Each of these candies has one color that is one of the colors called Color , Color , , and Color . For each , the color of the -th candy from the left is Color .
From this row, Takahashi can choose consecutive candies and get them. That is, he can choose an integer such that and get the -th, -th, -th, , -th candy from the left.
Takahashi likes to eat colorful candies, so the more variety of colors his candies have, the happier he will be. Print the maximum possible number of distinct colors in candies he gets.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible number of distinct colors in candies Takahashi gets.
7 3
1 2 1 2 3 3 1
3
If Takahashi gets the -rd through -th candies, they will have distinct colors, which is the maximum possible number.
5 5
4 4 4 4 4
1
Takahashi can get all of these candies, but they are in a single color.
10 6
304621362 506696497 304621362 506696497 834022578 304621362 414720753 304621362 304621362 414720753
4