P29657 [洛谷] [COCI2011-2012#2] TOP 5
普及-
题目描述

Problem Description

Given 8 numbers \( X_1, X_2, ..., X_8 \), select 5 numbers from them to maximize the sum of these 5 numbers. Output the sum of these 5 numbers and their indices. The index of \( X_i \) is \( i \).

Input Format

The input consists of 8 lines. Each line contains a positive integer \( X_i \). All \( X_i \) are guaranteed to be distinct.

Output Format

The output consists of two lines.

The first line contains an integer representing the maximum sum.

The second line contains 5 integers representing the indices of the 5 numbers, sorted in ascending order.

Sample Input and Output

Sample Input #1

20
30
50
48
33
66
0
64

Sample Output #1

261
3 4 5 6 8

Sample Input #2

20
0
50
80
77
110
56
48

Sample Output #2

373
3 4 5 6 7

Sample Input #3

20
30
50
80
110
11
0
85

Sample Output #3

355
2 3 4 5 8

Notes

Data Range

For 100% of the data, \( 1 \le X_i \le 150 \).

Explanation

This problem is scored according to the original COCI settings, with a full score of 50.

The problem is translated from COCI2011-2012 CONTEST #2 T1 NAJBOLJIH 5

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
20 30 50 48 33 66 0 64
样例输出
261 3 4 5 6 8