#P16917. [JLCPC 2026] 题列序 1
[JLCPC 2026] 题列序 1
Problem Description
You are given an integer sequence of length , where each value is in . One operation is defined as follows:
- Choose an index ().
- Let , then change all to at the same time.
You need to perform several operations (possibly none) to maximize the sum of all numbers in the sequence . At the same time, you must provide a valid operation plan whose number of operations does not exceed . It can be proven that a plan satisfying the operation limit always exists.
Input Format
The first line contains an integer (), the number of test cases. Then follow blocks, each describing one test case:
- The first line contains an integer (), the length of the sequence .
- The second line contains integers; the -th integer is ().
The data guarantees that .
Output Format
For each test case:
- The first line outputs two integers and , representing the maximum possible sequence sum and the number of operations in your plan. You must ensure $0 \le K \le \left\lfloor\dfrac{5}{7}n\right\rfloor + 100$.
- The next line outputs positive integers; the -th integer is the chosen for the -th operation.
3
3
0 1 0
5
0 2 1 2 2
7
1 1 1 1 1 1 1
3 1
1
10 4
2 2 3 1
14 5
1 3 4 5 1
Hint
Translated by ChatGPT 5