#K11056. Bonus Distribution Problem
Bonus Distribution Problem
Bonus Distribution Problem
In this problem, you are given an array of employee performance scores. Your task is to determine the minimum number of bonus points to allocate to the employees, subject to the following rules:
- Each employee must receive at least one bonus point.
- If an employee has a higher performance score than an adjacent employee, then the bonus points assigned to that employee must be greater than the bonus points assigned to that adjacent employee.
Mathematically, if we denote the bonus for the i-th employee as (b_i) and the performance as (p_i), then for any two adjacent employees:
[ \text{if } p_i > p_{i-1}, \text{ then } b_i > b_{i-1} ] [ \text{if } p_i > p_{i+1}, \text{ then } b_i > b_{i+1} ]
Your goal is to compute the minimum total bonus sum that satisfies the above conditions.
inputFormat
The first line of input contains an integer (n) (the number of employees). The second line contains (n) space-separated integers representing the performance scores of the employees.
outputFormat
Output a single integer representing the minimum total bonus points the company must distribute.## sample
1
5
1