Ghost Encounters

Source: AIO 2020

  1. Read the problem and summarise the task requirements.

Let’s analyse each ghost separately.

  1. Given K, Xi and Ti, what starting time leads to an encounter with ghost i?

  2. We’d now like to count the ghosts encountered by starting at various times. What data structure should you use?
  3. What is the time complexity of the algorithm? Using the constraints on the last page, estimate the running time.

  4. Implement the algorithm in code.
  5. Submit your program for judging!