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

Сборники > Kovrov IT > задача:


50925 - Optimizing Elevator Usage

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

Задачи сборника

• 51083 - Grades Histogram
• 51024 - Total Stock Price
• 51008 - Sum of Regional Maxes
• 51014 - Nine Men's Morris game
• Word Puzzle
• 50740 - Service Time - 1
• 50928 - War Of Battleships
• 50930 - Tom and Jerry
• 50925 - Optimizing Elevator Usage
• 50988 - Laplacian Filter
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50791 - Mine field
• 50912 - Trip to Librazhd
• Trip to Librazhd
• 50914 - Buy 3, Pay 2
• 50555 - Frekuenca e karaktereve

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

Если у вас есть предложения или пожелания по работе 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