文件目录

#include <bits/stdc++.h>
using namespace std;
struct person
{
    double t;
    int d;
} p[1050];
int n;
double t;
bool cmp(person a, person b)
{
    if (a.t == b.t)
        a.d < b.d;
    return a.t < b.t;
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> p[i].t;
        p[i].d = i;
    }
    sort(p + 1, p + n + 1, cmp);
    double sum = 0;
    for (int i = 1; i <= n; i++)
    {
        cout << p[i].d << " ";
        sum += p[i].t * (n - i);
    }
    cout << endl;
    // printf("%.2lf",sum/n);
    cout << fixed << setprecision(2) << sum / n;
    return 0;
}