Problems
Farmer John's
For each
Input
The first line consists of an integer
The next line contains
Output
For each
Subtask
| # | Score | Condition |
|---|---|---|
| #1 | 10 | |
| #2 | 20 | |
| #3 | 30 | No label appears more than |
| #4 | 40 | No additional constraints |
Example
9
1 1 1 9 2 1 2 1 1
7
5
4
4
4
4
4
3
3
Here are examples of how to assign cows to friendship groups for
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)