← 返回 amazon 的题目列表Lexicographically Smallest Permutation Minimizing Weighted Sum
类型:online_judge
amazon
Data analysts are analyzing the information gained when a model is trained with different arrangements of the same data. For any arrangement p of n integers, the information gained is ∑ (i * data[p[i]]). Given array data, find the lexicographically smallest permutation such that the information gained is minimal. If the input is n = 3 and data = [2, 4, 5], the output example should be [3, 1, 2].
Example
Input
3
2 4 5