Score : 400 points
Problem Statement
Let comb(n,r) be the number of ways to choose r objects from among n objects, disregarding order.
From n non-negative integers a1,a2,...,an, select two numbers ai>aj so that comb(ai,aj) is maximized.
If there are multiple pairs that maximize the value, any of them is accepted.
Constraints
- 2≤n≤105
- 0≤ai≤109
- a1,a2,...,an are pairwise distinct.
- All values in input are integers.
Input is given from Standard Input in the following format:
n
a1 a2 ... an
Output
Print ai and aj that you selected, with a space in between.
5
6 9 4 2 11
11 6
comb(ai,aj) for each possible selection is as follows:
- comb(4,2)=6
- comb(6,2)=15
- comb(6,4)=15
- comb(9,2)=36
- comb(9,4)=126
- comb(9,6)=84
- comb(11,2)=55
- comb(11,4)=330
- comb(11,6)=462
- comb(11,9)=55
Thus, we should print 11 and 6.
2
100 0
100 0