| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 1024 MB | 285 | 141 | 118 | 47.773% |
FJ gave Bessie an array $a$ of length $N$ (2ドル\le N\le 500, -10^{15}\le a_i\le 10^{15}$) with all $\frac{N(N+1)}{2}$ contiguous subarray sums distinct. For each index $i\in [1,N],ドル help Bessie compute the minimum amount it suffices to change $a_i$ by so that there are two different contiguous subarrays of $a$ with equal sum.
The first line contains $N$.
The next line contains $a_1,\dots, a_N$ (the elements of $a,ドル in order).
One line for each index $i\in [1,N]$.
2 2 -3
2 3
Decreasing $a_1$ by 2ドル$ would result in $a_1+a_2=a_2$. Similarly, increasing $a_2$ by 3ドル$ would result in $a_1+a_2=a_1$.
3 3 -10 4
1 6 1
Increasing $a_1$ or decreasing $a_3$ by 1ドル$ would result in $a_1=a_3$. Increasing $a_2$ by 6ドル$ would result in $a_1=a_1+a_2+a_3$.