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.
Submitting an official solution before solving the problem yourself is a bannable offence.
- Consider transposition — the number of ships at coordinate , 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 with a special property:
- it is an increasing sequence of numbers followed by decreasing sequence of numbers
- Increasing/decreasing subsequence is a well-known problem with solution using dynamic programming
Comments