링크 : https://www.acmicpc.net/problem/2822
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(const pair<int, int> &a, const pair<int, int> &b){
return a.second > b.second;
}
int main(){
vector<pair<int, int>> v;
vector<int> ans;
for(int i = 1; i < 9; i ++){
int num = 0;
cin >> num;
v.push_back({i, num});
}
sort(v.begin(), v.end(), cmp);
int sum = 0;
for(int i = 0; i < 5; i ++){
sum += v[i].second;
}
cout << sum << "\n";
for(int i = 0; i < 5; i++){
ans.push_back(v[i].first);
}
sort(ans.begin(), ans.end());
for(int i : ans){
cout << i << " ";
}
return 0;
}