A restaurant chef has prepared N dishes, each with a unique satisfaction rating. The chef must decide which dishes to serve and in what order to maximize customer satisfaction. Each dish takes exactly 1 time unit to prepare and serve. The contribution of each dish is calculated as its satisfaction rating multiplied by the time slot it's served in (1st slot, 2nd slot, etc.).
The chef can choose to discard any number of dishes and arrange the remaining ones in any order. Your task is to determine the maximum total satisfaction score achievable by optimally selecting and ordering the dishes.
Function Description:
Implement the function calculateMaxSatisfaction that takes the number of dishes and an array of satisfaction ratings, and returns the maximum possible total satisfaction score.
Function Parameters:
Return: An integer representing the maximum total satisfaction score achievable.
Input Format:
Output Format: Print a single integer the maximum total satisfaction score.
Sample Input 1
5
-1 -8 0 5 -9
Sample Output 1
14
OYO (Prism) • Pending