Ship Traffic: Difference between revisions

From programming_contest
Jump to navigation Jump to search
imported>Kmk21
Created page with "#calculate the time that any given ship would start blocking the ferry in that lane, and stop blocking the ferry in that lane #convert these all to times that the ferry can st..."
 
(No difference)

Latest revision as of 04:45, 25 August 2016

  1. calculate the time that any given ship would start blocking the ferry in that lane, and stop blocking the ferry in that lane
  2. convert these all to times that the ferry can start, leaving us with a list of times that the start Starts getting blocked, and stops getting blocked
  3. sort this list and walk it...any time there are 0 boats blocking the ferry, check if the gap to the next ship starting to block is the longest

This is another one of those "I can't believe this is a finals problem"