#P7614. Maximum Sum Subset of Five from Eight Numbers
Maximum Sum Subset of Five from Eight Numbers
Maximum Sum Subset of Five from Eight Numbers
Given eight numbers \(X_1, X_2, \ldots, X_8\), select five numbers such that their sum is maximized. Output the maximum sum of the selected five numbers and the indices of these numbers. Note that the index of \(X_i\) is \(i\).
inputFormat
The input consists of eight space-separated integers representing \(X_1\) to \(X_8\).
outputFormat
The first line should contain the maximum sum of the selected five numbers. The second line should contain the indices (in ascending order) of these numbers separated by a space.
sample
1 2 3 4 5 6 7 8
30
4 5 6 7 8
</p>