#include #include #include #include using namespace std; struct cmp{ bool operator()(const pair& a, const pair& b) const{ if(a.second != b.second) return a.second < b.second; else return a.first < b.first; } }; int main(){ set, cmp> s; int n; cin >> n; int tmp; double all = 0; for(int i = 0; i < n; i++){ cin >> tmp; s.emplace(make_pair(i + 1, tmp)); } auto x = s.begin(); for(int i = 0; i < n; i++){ cout << (*x).first << " "; all += (n - i - 1) * (*x).second; x++; } cout << endl; cout << fixed << setprecision(2) << all / n << endl; return 0; }