A Colourful Prospect

Source: Codeforces 933C

  1. Read the problem and summarise the task requirements.
  2. Do some examples with pen and paper.
  3. In lectures, we developed a method to check whether line segments intersect.
  4. Design an algorithm to solve the problem.

  5. Analyse the time complexity of your algorithm and estimate its running time.

  6. Implement this algorithm in code.
  7. Submit your program for judging!