Starting from:

$30

Homework 04: Airport Runway Problem Solution

Instruction




Submit your answer to this question via PC^2 under your account by the posted due time. No late submissions will be accepted. Note that homework is opened-book, but no outside assistance is permitted.




Problem




You are in charge of building an airport runway scheduling system. Let's say that today you have 5 landings scheduled at time 37, 41, 46, 49, and 56, but now another airline wants to see if they can schedule landings at time 44, 53, and 20 as well. How could we handle this new request?




We have this new request for landings that need to be checking to see whether it would overlap within k time with another scheduled flight or not. If so, we could not insert it into our schedule. The input file contains several lines, one for each number to be scheduled. Each line contains first integer n, where n is the number of scheduled landings today, follows by the scheduled time for landings, k time to check overlap, and new request time for landings.




Write a program that maintains reservations for set of landings on airport runway scheduling system.




Sample input




5,37,41,46,49,56,3,44,53,20







Sample output




Request at time 44 is not allowed




Request at time 53 is allowed




Request at time 20 is not allowed

More products