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

Турниры > CEN303_2016Questions > задача:


HW033. 50925 - Optimizing Elevator Usage

CEN303_2016Questions

Старт: 28.окт.2016 в 17:00:00
Финиш: 01.ноя.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (2)

Задачи турнира

• FE3. 51075 - Shortest Path for Bishop
• HW011. 51008 - Sum of Regional M...
• HW012. 51009 - Sum of the nth row
• HW021. 51011 - Decoding the Path
• HW022. 51012 - Palindrome-k
• HW023. 50741 - DNA Distance
• HW031. 51015 - Student Scholarships
• HW032. 51014 - Nine Men's Morris g...
• HW033. 50925 - Optimizing Elev...
• HW051. 51019 - Finding the hidden...
• HW052. 51020 - Number of nodes r...
• HW061. 50448 - Paint Buckets
• HW062. 51021 - Number of Nodes
• HW071. 51042 - The most frequent ...
• HW072. 51043 - Genome Sequencing
• HW081. 51044 - Number of Trees
• HW082. 50699 - Fighting Vampires

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
IMPC16 The Third Contest Q1.

Optimizing Elevator Usage

In the mornings, many people want to leave building and in the evenings many people come to the building to go for upper floors. So, you want to optimize the waiting time for people according to the given precision. In a file you have recorded the elevator floor numbers and their request times. For example, if hourly precision is selected and if many people ask elevator from the floors 10 and 12 between 8:00 and 09:00, it’s better if the elevator is close to these floors on its free times, so that the elevator can serve faster.

Question: Write a program that reads the usage information for the elevator, and the precision. Then, show the waiting floors for the given hours.

Input specification:
You will be given first:

  • The number of usage entries (n): an integer between 1 and 10,000
  • Precision asked: an integer between 2 and 720, a perfect divisor of 720 where 2 means 2 minutes precision. 60 means hourly precision.
Then, the following n lines will contain three integers: floor requesting the elevator, hour and minute of the request. The next line has an integer: the number of hours for which the waiting floors asked (m): between 1 and 200. The following m lines contain two integers: hour and minute for which you will print the waiting floors.
Note: You will round the floor numbers to the nearest integer.

Output specification:
Show m integers. If there is no information provided for the given hour and minute, print 0.

Sample Input I
5 60
16 11 22
9 7 27
4 9 53
16 7 7
14 11 50
2
11 25
7 55
Sample Output I
15
13

Explanation: Hourly precision is selected. And, two times are asked: at 11:25 and 7:55. There are two usage information provided between 11 and 12. At 11:22, the elevator was asked from floor 16 and and at 11:50, it was asked from floor 14. So, according to the current usage schema, because many people close to floor 15 are using it, it is better the elevator to stay on floor 15 on its free times between 11 and 12.



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

www.contester.ru