sume
Zaharel has decided to choose a lucky number for him. He will go about choosing it like this: write a row A of N positive integers and form all Ai+Aj sum pairs with 1<=i, j<=N. Then, sort the N2 sums in descending order and choose the K-th in order of sorting.
Task
Being given row A of N numbers, determine for Zaharel the K-th sum in order of sorting.
Input Data
The first line of input file sume.in contains the two positive integers, N and K, separated by a space. The following N lines will contain the elements of one-dimensional array A, one per line.
Output Data
File sume.out will contain a single line with the K-th sum in order of sorting.
Restrictions
1<=N<=50 000
1<=K<=N2
0<=Ai < 220
Examples
sume.in |
sume.out |
Explanation |
3 6 |
8 |
The 9 sums in order of sorting are: |
Time limit: 0.2 seconds/test
Mircea Paşoi
University of Bucharest, Mathematics & IT Department
bogdanpasoi@yahoo.com