#P7614. [COCI 2011/2012 #2] NAJBOLJIH 5
[COCI 2011/2012 #2] NAJBOLJIH 5
Description
Given numbers , choose of them so that the sum of these numbers is as large as possible. Output the sum of these numbers and their indices. The index of is .
Input Format
The input has lines. The -th line contains a positive integer . It is guaranteed that all are distinct.
Output Format
The output has two lines.
The first line contains an integer, representing the maximum possible sum.
The second line contains integers, representing the indices of the chosen numbers, sorted in ascending order.
20
30
50
48
33
66
0
64
261
3 4 5 6 8
20
0
50
80
77
110
56
48
373
3 4 5 6 7
20
30
50
80
110
11
0
85
355
2 3 4 5 8
Hint
Constraints
For of the testdata, .
Notes
The score for this problem follows the original COCI setting, with a full score of .
Translated from COCI2011-2012 CONTEST #2 T1 NAJBOLJIH 5.
Translated by ChatGPT 5
京公网安备 11011102002149号