HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array_and_Matrices > problem:


50114 - Close Pairs - Revised

Volume problems

• 50076 - Zero Padding
• 50077 - Valid Permutations
• 50080 - Student averages
• 50090 - Row Min Subtraction
• 50098 - Cryptography
• 50099 - Snake
• 50100 - The biggest result
• 50106 - Weekly Report
• 50114 - Close Pairs - Revised
• 50123 - Contest Scoreboard
• 50124 - Falling Bricks
• 50129 - Sequential Numbers
• 50131 - Reading Book
• 50133 - Climbing Up the Stairs
• 50135 - Lines
• 50136 - Confusion Matrix
• 50137 - Filling a Matrix Randomly

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.
Question by Ibrahim Mesecan.

Close Pair

Question: You will be given n integer numbers. Print the two numbers whose difference is the closest. Show any two, if there are many numbers giving the same minimum difference.

Input specification
You will be first given a number (n) which shows the number of numbers where 0 ≤ n ≤ 1000. Then in following n lines you will be given n numbers where each number is between -10000 and 10000.

Output specification
Print the two numbers whose difference is the closest.

 Sample Input I     Sample Input II   
 3
 8 5 6
 5
 6 -5 6 8 3
 Sample Output I     Sample Output II   
 5 6
 6 6


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

www.contester.ru