Akuna CapitalOA #9
Counter Differences
估计简单可在线判题
For each position i of the array, check every j<i from left to right: if the left value is greater than the current value, subtract the absolute difference; if the left value is less than or equal to the current value, add the absolute difference. Output the accumulated counter for each position.
输入格式
The first line contains n; the second line contains n integers arr[i]. The original gives no value constraints; this site adds 1≤n≤100000, −10^9≤arr[i]≤10^9.
输出格式
Output n integers, the counter of each position in the original array order.
样例 1
输入:
3
2 4 3
输出:
0 2 0
样例 2
输入:
1
7
输出:
0
样例 3
输入:
4
3 3 1 5
输出:
0 0 -4 8