#P1794C. Scoring Subsequences
Scoring Subsequences
No submission language available for this problem.
Description
The score of a sequence is defined as , where . In particular, the score of an empty sequence is .
For a sequence , let be the maximum score among all its subsequences. Its cost is defined as the maximum length of a subsequence with a score of .
You are given a non-decreasing sequence of integers of length . In other words, the condition is satisfied. For each , find the cost of the sequence .
A sequence is a subsequence of a sequence if can be obtained from by deletion of several (possibly, zero or all) elements.
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains an integer () — the length of the given sequence.
The second line of each test case contains integers () — the given sequence. It is guaranteed that its elements are in non-decreasing order.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output integers — the costs of sequences in ascending order of .
Input
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains an integer () — the length of the given sequence.
The second line of each test case contains integers () — the given sequence. It is guaranteed that its elements are in non-decreasing order.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output integers — the costs of sequences in ascending order of .
Note
In the first test case:
- The maximum score among the subsequences of is . The subsequences and (the empty sequence) are the only ones with this score. Thus, the cost of is .
- The maximum score among the subsequences of is . The only subsequence with this score is . Thus, the cost of is .
- The maximum score among the subsequences of is . The subsequences and are the only ones with this score. Thus, the cost of is .