pair
#include <iostream>
#include <algorithm>
typedef long long LL;
using namespace std;
typedef pair<int, int> PII;
const int N = 1010;
int n;
PII a[N];
int main()
{
cin >> n;
for (int i = 1; i <= n; i ++ ) cin >> a[i].first, a[i].second = i;
LL sum = 0;
sort(a + 1, a + n + 1);
for (int i = 1; i < n; i ++ ) sum += (LL)a[i].first * (n - i);
for (int i = 1; i <= n; i ++ ) cout << a[i].second << ' ';
printf("\n%.2lf\n", sum / (n * 1.0));
return 0;
}
#include <iostream>
#include <algorithm>
typedef long long LL;
using namespace std;
const int N = 1010;
struct Rec
{
int t, b;
}a[N];
int n;
int main()
{
cin >> n;
for (int i = 1; i <= n; i ++ ) cin >> a[i].t, a[i].b = i;
LL sum = 0;
sort(a + 1, a + n + 1, [&](Rec a, Rec b){
return a.t < b.t;
});
for (int i = 1; i < n; i ++ ) sum += (LL)a[i].t * (n - i);
for (int i = 1; i <= n; i ++ ) cout << a[i].b << ' ';
printf("\n%.2lf\n", sum / (n * 1.0));
return 0;
}