atcoder#ABC272C. [ABC272C] Max Even
[ABC272C] Max Even
Score : points
Problem Statement
You are given a sequence of length consisting of non-negative integers.
Determine if there is an even number represented as the sum of two different elements of . If it exists, find the maximum such number.
Constraints
- The elements of are distinct.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print -1
if there is no even number represented as the sum of two different elements of .
If such an even number exists, print the maximum such number.
3
2 3 4
6
The values represented as the sum of two distinct elements of are , , and . We have an even number here, and the maximum is .
2
1 0
-1
The value represented as the sum of two distinct elements of is . We have no even number here, so -1
should be printed.