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.
Submitting an official solution before solving the problem yourself is a bannable offence.
- Sort all intervals by
(they also get ordered by
automatically). It is easy to prove that the new intervals must follow in the same order
- The solution is the minimum of
for all pairs of
and
when
, but this solution is
and will not fit into the time limit.
- The solution is the minimum of
- The correct solution is to use binary search to find the answer length and then find the closest simple irreducible fraction
to this answer
Comments