HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Sorting and sequences > problem:


50906 - The Smallest Pair

Section problems

• 50906 - The Smallest Pair
• 50730 - The largest product
• 50731 - The largest product (2)
• 50732 - Sorting
• 50549 - k-Nearest Neighbours (kNN)
• 50290 - Minimax Sum
• 50738 - Median value
• 50317 - Student Line Up
• 50311 - Student Line Up

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

The Smallest Pair

You are given a sequence a1, a2, ..., aN. Find the smallest possible value of ai + aj, where 1 ≤ i < jN.

Input

The first line of each description consists of a single integer N.

The second line of each description contains N space separated integers - a1, a2, ..., aN respectively.

Output

A single line containing a single integer (the smallest possible sum).

Sample Input1:

Sample Input2:

4

5 1 3 4

10

9 2 7 4 5 6 3 8 1 10

Sample Output2:

Sample Output2:

4

3

Explanation of Sample1:

Here we pick a2 and a3. Their sum equals to 1 + 3 = 4.

 

Для отправки решений необходимо выполнить вход.

www.contester.ru