Editorial for GFSSOC '14 Winter S5 - Stardust Snow
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.
We can turn this problem into a 4D dynamic programming question where we keep track of horizontal position, time, snowflakes left, and temperature left. At each position, consider two cases, one where Griffy takes the snowflake (if a snowflake exists at that position and time), and the other where Griffy does not take the snowflake. TIME STARTS AT 0.
Skills needed: Dynamic programming
Time complexity:
Comments