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

Разделы > Linear Data Structures: Arrays > задача:


50925 - Optimizing Elevator Usage

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

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

• 50531 - File Decryption
• 50360 - National Elections
• 50469 - Letter Grades
• 50468 - Draw Matrix - 2
• 51099 - Mr. Monk
• 51012 - Palindrome-k
• 51096 - Guess the number - 2
• 50448 - Paint Buckets
• 50925 - Optimizing Elevator Usage
• 50269 - Matrix Determinant
• 50988 - Laplacian Filter
• 50986 - The Oldest Person
• 51173 Question 5
• 50873 - Max Frequency
• 51009 - Sum of the nth row
• 51107 - Factorial
• ECE - Question 1

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

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