Editorial for TLE '16 Contest 2 P1 - In Debt


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.

Author: ZQFMGB12

Simply simulate the borrowing/returning and keep track of the current debt, the maximum debt, and the earliest date with the maximum debt (only replace this variable if the current debt is strictly greater than the maximum debt stored). Keep in mind that the debt starts at $0, so if the debt across all days is never positive, 0 should be printed.

Time Complexity: \mathcal{O}(N)


Comments

There are no comments at the moment.