Equal Sum Subarrays G
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Equal Sum Subarrays G
题目描述
Note: The time limit for this problem is 3s, 1.5x the default.
FJ gave Bessie an array of length with all contiguous subarray sums distinct. For each index , help Bessie compute the minimum amount it suffices to change ai by so that there are two different contiguous subarrays of a with equal sum.
输入格式
The first line contains .
The next line contains (the elements of , in order).
输出格式
One line for each index .
样例 1
2
2 -3
2
3
样例 2
3
3 -10 4
1
6
1
说明/提示
Explanation for Sample 1
Decreasing by would result in . Similarly, increasing by would result in .
Explanation for Sample 2
Increasing a1 or decreasing by would result in . Increasing by would result in .
SCORING
- Input :
- Input :
- Inputs :
- Inputs 8-16: No additional constraints.