PROSORT 2019 Problem D Help!

Can anyone please explain the approach to the problem:

This problem is JOI 2016 skyscraper. Zscoder has provided a detailed explanation here (it’s under connected component DP).

1 Like