Logo
(追記) (追記ここまで)

27843번 - Equal Sum Subarrays 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB28514111847.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]$.

제한

예제 입력 1

2
2 -3

예제 출력 1

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$.

예제 입력 2

3
3 -10 4

예제 출력 2

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$.

힌트

출처

Olympiad > USA Computing Olympiad > 2022-2023 Season > USACO 2023 February Contest > Gold 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /