Good Bye 2021: 2022 is NEAR
C
Representative Edges
Codeforces
1500
原题
← BD →
翻译中…

An array $a_1, a_2, \ldots, a_n$ is good if and only if for every subsegment $1 \leq l \leq r \leq n$, the following holds: $a_l + a_{l + 1} + \ldots + a_r = \frac{1}{2}(a_l + a_r) \cdot (r - l + 1)$.

翻译中…

You are given an array of integers $a_1, a_2, \ldots, a_n$. In one operation, you can replace any one element of this array with any real number. Find the minimum number of operations you need to make this array good.

翻译中…

Input

翻译中…

The first line of input contains one integer $t$ ($1 \leq t \leq 100$): the number of test cases.

翻译中…

Each of the next $t$ lines contains the description of a test case.

翻译中…

In the first line you are given one integer $n$ ($1 \leq n \leq 70$): the number of integers in the array.

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($-100 \leq a_i \leq 100$): the initial array.

翻译中…

Output

翻译中…

For each test case, print one integer: the minimum number of elements that you need to replace to make the given array good.

翻译中…

Note

翻译中…

In the first test case, the array is good already.

翻译中…

In the second test case, one of the possible good arrays is $[1, 1, \underline{1}, \underline{1}]$ (replaced elements are underlined).

翻译中…

In the third test case, the array is good already.

翻译中…

In the fourth test case, one of the possible good arrays is $[\underline{-2.5}, -2, \underline{-1.5}, -1, \underline{-0.5}, 0]$.

翻译中…

样例

Input #1
5
4
1 2 3 4
4
1 1 2 2
2
0 -1
6
3 -2 4 -1 -4 0
1
-100
Output #1
0
2
0
3
0
InputCopy OutputCopy
题目信息
题号
1616C
时间限制
1 s
内存限制
256 MB
标签
暴力
计算几何
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。