#P9127. [USACO23FEB] Equal Sum Subarrays G
[USACO23FEB] 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 .
2
2 -3
2
3
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.