Editorial for ICPC NEERC 2014 I - Improvements


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.
  • Consider transposition aj — the number of ships at coordinate j, that is reverse to what is given in the input
  • It is easy to prove that the chain of ships that remain on their initial position corresponds to a subsequence of aj with a special property:
    • it is an increasing sequence of numbers aj followed by decreasing sequence of numbers aj
  • Increasing/decreasing subsequence is a well-known problem with O(nlogn) solution using dynamic programming

Comments

There are no comments at the moment.