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 |
Для отправки решений необходимо выполнить вход.
|