HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Albanian National Olympiads in Informatics > problem:


2014-2. 50738 - Median value

Guest
• Discussion of problem (1)

Volume problems

• 2013-1. 50591 - Leap year
• 2013-3. 50570 - Prime numbers in t...
• 2013-4. 50958 - ATM
• 2013-5. 50543 - Hotel rooms
• 2013-6. 50562 - List of students
• 2012-1. 50544 - Stock market
• 2012-4. 50680 - Triangle
• 2012-5. 50551 - Camelot
• 2014-2. 50738 - Median value
• 2012-3. 50721 - Palindrome

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.
Prepared by: Evis Hoxha. Difficulty Beta

Median value

Given N objects with different materials, whose hardness is specified by a natural number Y. Scientists want to make some experiments. For this they need a program to calculate the median of the numbers.

Your program should be able to calcualate the median of three numbers specified by their index and the median of all the numbers.

Input
The first line is the number of objects N, which is an odd number. The following line contains N numbers, which are the hardness of the objects. The next line contains a number K. The following K lines contain three numbers which represent the indexes of the objects.(index starts with 0)

Output
The first line is the median value of the N objects. Then, the following K lines contain the position of the median value.

Input I
5
2 5 4 3 1
3
0 1 2
2 3 0
3 2 4
Output 1
3
2
3
3

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

www.contester.ru