[Solution] Doremy's Paint Codeforces Solution
Doremy has buckets of paint which is represented by an array of length . Bucket contains paint with color .
Let be the number of distinct elements in the subarray . Choose integers and such that and is maximized.
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains integers ().
It is guaranteed that the sum of does not exceed .
For each test case, output and such that and is maximized.
If there are multiple solutions, you may output any.
In the first test case, .
- When and , (there are distinct elements in ).
- When and , (there are distinct elements in ).
It can be shown that choosing and maximizes the value of at .
For the second test case, .
- When and , (there are distinct elements in ).
- When and , (there is distinct element in ).
It can be shown that choosing and maximizes the value of at . Choosing and is also acceptable.
No comments:
Post a Comment