Advanced DP design
- Stage
- 6
- Module
- M6.7
- Lessons
- 1
In this module
- Combine a second dimension, such as a resource limit, with a DP state that is sorted by position.
- Optimize DP transitions that need a window maximum with a monotonic deque.
- Recognize when the best predecessor for a DP transition only moves forward, so a single pointer sweeps the whole array once.
- Apply rolling arrays and tuple sorting for fast Python performance on hard S4/S5 problems.
Before this module
Lessons
Practice
Try these on the judge. Each link opens the problem on DMOJ.
- 2019 S4Tourism (opens on DMOJ in a new tab) DMOJ
Plan a multi-day itinerary that visits the most cities under a travel budget.
- 2015 S5Greedy For Pies (opens on DMOJ in a new tab) DMOJ
Split a set of pies among people so that the smallest share is as large as possible.