##### Canadian Computing Olympiad: 2019 Day 2, Problem 1

You have a deck of cards. Each card has a value: the card values lie between to , possibly with some repeated values, and possibly with some values never occurring. There is also a special integer that will be used in calculating a score.

You are playing a game that involves drawing all the cards from the deck one by one. When you draw a card, you may choose to either add it to your hand or discard it. You may also score your entire hand at any time. When you score a hand with cards, you gain points and then you discard all cards in that hand. At any point in time, your hand may only contain cards with the same number on them. Given the initial order of the cards in the deck, what is the maximum possible score you can obtain?

#### Input Specification

The first line of input will contain two space-separated integers and . The value is the value used in the expression to compute points . The value is the number of cards in the deck . The next lines contain one integer per line, where the of these lines is the card from the top of the deck .

For 4 of the 25 marks available, .

For an additional 1 of the 25 marks available, , .

For an additional 5 of the 25 marks available, .

For an additional 3 of the 25 marks available, .

For an additional 3 of the 25 marks available, .

#### Output Specification

Output one floating point number, which is the maximum score you can obtain from playing optimally.

If your answer is and the correct answer is , then your answer will be considered correct if

#### Sample Input 1

```
3 5
1
2
2
1
1
```

#### Output for Sample Input 1

`6.656854249`

#### Explanation for Output for Sample Input 1

We know the cards we draw in order are and that discarding a hand of cards gives us a score of .

The optimal strategy is to draw one card, score that hand, draw two cards, score that hand, and draw two more cards and score that hand. This strategy gives a score of .

#### Sample Input 2

```
4 5
1
2
2
1
1
```

#### Output for Sample Input 2

`9.0`

#### Explanation of Output for Sample Input 2

We know the cards we draw in order are and that scoring a hand of cards gives us a score of .

An optimal strategy is to take all cards with , and score them all at the end. This strategy gives a score of . Note that taking the first card and scoring, then taking the next two cards and scoring, and then taking the final two cards and scoring, will also yield .

## Comments

this problem was pretty hard but i still solved it next im gonna attempt cco19p3

Why was my comment about problem difficulty deleted?

Edit: original comment was something like: