| 2025 GUC Winter Camp |
|---|
| Закончено |
Yasser, a math enthusiast with a particular fondness for arithmetic sequences, has an interesting challenge. He has an array $$$a$$$ of length $$$n$$$, and his objective is to determine if this array can be transformed into an arithmetic sequence through a series of allowed operations.
An arithmetic sequence is a list of numbers where the difference between consecutive terms remains constant. For instance, the sequence 3, 7, 11, 15 is an arithmetic sequence because the difference between each term is 4 (7 - 3 = 11 - 7 = 15 - 11 = 4).
Yasser can perform some operations on the array. In each operation, he can select an element at any index and either:
1 - Add an integer between 1 and 10 (inclusive) to the chosen element.
2 - Subtract an integer between 1 and 10 (inclusive) from the chosen element.
3 - Leave the element unchanged.
There's a crucial condition: Yasser can only modify each element in the array at most once.
Finally, Yasser is given an array of integers. Can you assist Yasser in determining if it's possible to transform the array into a perfect arithmetic sequence?
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements in $$$a$$$.
The second line of each test case contains $$$n$$$ integers ($$$\lvert a_i \rvert \le 10^9$$$).
It is guaranteed that the sum of $$$n$$$ over test cases does not exceed $$$10^5$$$.
If it is impossible to make an arithmetic progression with the described operations, print "NO", otherwise, print "YES".
You can output "YES" and "NO" in any case (for example, strings "yES", "yes" and "Yes" will be recognized as a positive response).
343 6 8 1231 10 5031 10 70
YESYESNO
| Название |
|---|


