#C11645. Even Pair Sum Checker
Even Pair Sum Checker
Even Pair Sum Checker
You are given two arrays A and B of equal length N. Your task is to determine whether there exists a pair of indices \((i, j)\) such that the sum \(A_i+B_j\) is even.
In other words, you need to check if either:
- There is at least one even number in A and at least one even number in B, or
- There is at least one odd number in A and at least one odd number in B.
If one of these conditions is met for a test case, output YES
; otherwise, output NO
.
Note: All formulas are rendered in \(\LaTeX\) format.
inputFormat
The input is read from standard input (stdin) and has the following format:
T N A1 A2 ... AN B1 B2 ... BN ... (repeated for each test case)
Where:
T
is the number of test cases.- For each test case:
N
is the number of elements in each array.- The next line contains
N
space-separated integers for array A. - The following line contains
N
space-separated integers for array B.
outputFormat
For each test case, print a single line containing YES
if there exists a pair \((i, j)\) such that \(A_i+B_j\) is even; otherwise, print NO
. The output should be printed to standard output (stdout).
2
3
1 2 3
4 5 6
3
1 3 5
2 4 6
YES
NO
</p>