Editorial for ICPC NEERC 2012 C - Caravan Robbers


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
  • Sort all intervals by ai (they also get ordered by bi automatically). It is easy to prove that the new intervals must follow in the same order
    • The solution is the minimum of bjaiji+1 for all pairs of i and j when ij, but this solution is O(n2) and will not fit into the time limit.
  • The correct solution is to use binary search to find the answer length and then find the closest simple irreducible fraction p/q to this answer

Comments

There are no comments at the moment.