HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50906 - The Smallest Pair

Volume problems

• 50835 - Club Presidency
• 50526 - Gold Market
• 50458 - Weekly Report
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50405 - Accounts Receivable
• 50371 - Modified Karnaugh-Map
• 50908 - Buy 1 Get 1
• 50906 - The Smallest Pair
• 51043 - Genome Sequencing
• 51042 - The most frequent k-mer
• 51149 - One Piece Arena
• 51069 - Last Digit of a Fibonacci Nu...
• 50659 - Covariance Matrix
• 50977 - Gaussian Elimination
• Raporti Javor
• 50657 - Permutations and Combinat...

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