{"problem":{"name":"[USACO23FEB] Equal Sum Subarrays G","description":{"content":"**Note: The time limit for this problem is 3s, 1.5x the default.**  FJ gave Bessie an array $a$ of length $N(2 \\le N \\le 500,−10^{15} \\le a_i \\le 10^{15})$ with all $\\dfrac{N(N+1)}{2}$ contiguous sub","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":{"LuoguStyle":"P4"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9127"},"statements":[{"statement_type":"Markdown","content":"**Note: The time limit for this problem is 3s, 1.5x the default.** \n\nFJ gave Bessie an array $a$ of length $N(2 \\le N \\le 500,−10^{15} \\le a_i \\le 10^{15})$ with all $\\dfrac{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 ai by so that there are two different contiguous subarrays of a with equal sum. \n\n## Input\n\nThe first line contains $N$.\n\nThe next line contains $a_1, \\cdots ,a_N$\n(the elements of $a$, in order). \n\n## Output\n\nOne line for each index $i \\in [1,N]$. \n\n[samples]\n\n## Note\n\n### Explanation for Sample 1\n\nDecreasing $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$. \n\n### Explanation for Sample 2\n\nIncreasing a1 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$. \n\n### SCORING\n\n - Input $3$: $N \\le 40$\n - Input $4$: $N \\le 80$\n - Inputs $5-7$: $N \\le 200$\n - Inputs 8-16: No additional constraints.","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9127","tags":["USACO","2023","排序","线性递推"],"sample_group":[["2\n2 -3","2\n3"],["3\n3 -10 4","1\n6\n1"]],"created_at":"2026-03-03 11:09:25"}}