[Solution] Madoka and Formal Statement Codeforces Solution
Given an array of integer . In one operation you can make if and , or and .
You need to check whether the array can become equal to the array in some number of operations (possibly, zero). Two arrays and of length are called equal if for all integers from to .
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases. Description of the test cases follows.
The first line of each test case contains a single integer () – the length of the array.
The second line of each test case contains integers () – the elements of the array .
The third line of each test case contains integers () – the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output "YES" if you can get the array , otherwise output "NO".
You may print each letter in any case (for example, "YES", "Yes", "yes", "yEs" will all be recognized as positive answer).
In the first test case, the array is already equal to the array .
In the second test case, we can't get the array , because to do this we need to decrease .
In the fifth test case, we can apply operations in order to the elements with indices , and then get the array . After that, you can apply operations in order to elements with indices and already get an array .
No comments:
Post a Comment