#K72932. Even-Odd Array Checker
Even-Odd Array Checker
Even-Odd Array Checker
Given an array of integers, determine whether it is an Even-Odd Array. An array is considered an Even-Odd Array if:
- The array is non-empty.
- For every even-indexed position (where index is 0-based), the element is even, i.e., \(A[i] \mod 2 = 0\).
- For every odd-indexed position, the element is odd, i.e., \(A[i] \mod 2 = 1\).
If the array meets all the above conditions, output True
, otherwise output False
.
inputFormat
The input is given via standard input (stdin) and has the following format:
n a1 a2 a3 ... an
Here, n
is the number of elements in the array and a1, a2, ..., an
are the integer elements of the array.
outputFormat
Output a single line to standard output (stdout) containing either True
or False
depending on whether the array is an Even-Odd Array.
6
2 1 4 3 6 5
True