logo AlgoBeat OnlineJudge
登录 注册

#208472. [USACO23FEB] Equal Sum Subarrays G

内存限制:256 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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

样例输出 1

2
3

样例输入 2

3
3 -10 4

样例输出 2

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.