#K83392. Distribute Employee Bonus
Distribute Employee Bonus
Distribute Employee Bonus
A company wants to distribute bonuses to its employees based on their performance ratings. Every employee must receive at least one bonus unit. Moreover, if an employee has a higher performance rating than an adjacent employee, this employee must receive more bonus units than that neighbor.
Formally, let the performance ratings be given as an array R of length n and the bonus distributions as an array B of length n. The following conditions must be satisfied:
- For every i, B[i] \(\geq\) 1.
- If \(R[i] > R[i-1]\) then \(B[i] > B[i-1]\) for \(1 \leq i < n\).
- If \(R[i] > R[i+1]\) then \(B[i] > B[i+1]\) for \(0 \leq i < n-1\).
Your task is to calculate the minimum bonus distribution that meets these requirements.
inputFormat
The first line of the input contains a single integer n (which can be 0), representing the number of employees. If n > 0, the second line contains n space-separated integers representing the performance ratings of the employees.
outputFormat
Output a single line containing n space-separated integers denoting the bonus units distributed to the employees. If n = 0, output nothing.
## sample3
1 0 2
2 1 2