You are given an array
consisting of positive integers.
You are allowed to perform this operation any number of times (possibly, zero):
- choose an index (), and change to .
Is it possible to make for all ?
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line contains one integer () — the length of array .
The second line contains integers ().
For each test case, print "YES" (without quotes), if it is possible to change to for all , and "NO" (without quotes) otherwise.
You can print letters in any case (upper or lower).
4 2 5 10 3 1 2 3 4 1 1 1 1 9 9 9 8 2 4 4 3 5 3
YES YES YES NO
In the first test case, the initial array is . You can perform operations to reach the goal:
- Choose , and the array becomes .
- Choose , and the array becomes .
In the second test case, the initial array is . You can perform operations to reach the goal:
- Choose , and the array becomes .
- Choose , and the array becomes .
- Choose , and the array becomes .
- Choose , and the array becomes .
In the third test case, you can choose indices in the order , , .
No comments:
Post a Comment