CEN303_2016Questions |
Start: Oct.28.2016 at 05:00:00 PM
Finish: Nov.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard
|
Feedback | If you notice incorrect translations in Contester, please let author know.
|
|
Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
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.
Для отправки решений необходимо выполнить вход.
|