HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Albanian National Olympiads in Informatics > problem:


2010-2. 50299 - Median

Volume problems

• 2010-1. 50298 - Coins
• 2010-2. 50299 - Median
• 2010-3. 50300 - Matrix
• 2012-1. 50544 - Stock market
• 2012-2. 50545 - Diet
• 2012-3. 50721 - Palindrome
• 2012-4. 50680 - Triangle
• 2012-5. 50551 - Camelot
• 2013-1. 50591 - Leap year
• 2013-3. 50570 - Prime numbers in t...

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.
Olympiad 2010. Prepared by: Evis Hoxha. Difficulty Alpha

Median


Given n integer. Write a program that finds a number A in the sequence, such that A has the property that the given amount of numbers that are smaller than A is the same with the given amount of numbers that are bigger than this number A. Also do not forget about the case when this kind of number A can not exist.

Input
First line of input is the number n, where 3<=n<=10 000. Then next n numbers are given in ascending order. Each number is positive.

Output
Show number A if it exists. Otherwise show 0

Input I
5
1 2 3 4 9
Output 1
3

Input II
5
1 2 3 3 3
Output II
0

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

www.contester.ru