ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Сортировка и последовательности > задача:


50738 - Median value

Гость
• Обсуждение задачи (1)

Задачи раздела

• 50912 - Trip to Librazhd
• 50914 - Buy 3, Pay 2
• 50732 - Sorting
• 50730 - The largest product
• 50731 - The largest product (2)
• 50737 - Sum of the k-largest numbers
• 50492 - Contest Scoreboard
• 50320 - Random Sorted List
• 50738 - Median value
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50736 - Top N Donors - 2
• 50333 - Series of Squares
• 50734 - Product Info (In Srt)
• 50364 - Student averages
• 50733 - The Highest Average
• 50358 - Series of Odd Numbers

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by: Evis Hoxha. Сложность Бета

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