#C13980. Longest Contiguous Even Subarray

    ID: 43578 Type: Default 1000ms 256MiB

Longest Contiguous Even Subarray

Longest Contiguous Even Subarray

Given an array of integers, find the longest contiguous subarray consisting entirely of even numbers. If there are multiple subarrays with the same maximum length, output the first one encountered.

Formally, for an array \(A\) of integers, find the contiguous segment \(A[i], A[i+1], \ldots, A[j]\) such that for every \(k\) with \(i \le k \le j\), \(A[k] \mod 2 = 0\), and the length \(j-i+1\) is maximized. If no even numbers exist, output an empty line.

inputFormat

The first line contains an integer \(n\) denoting the number of elements in the array. The second line contains \(n\) space-separated integers representing the elements of the array.

outputFormat

Output the longest contiguous subarray of even numbers, with its elements separated by a single space. If there are no even numbers, output an empty line.

## sample
0