Dynamic Programming21 sections · 916 units
Open in Course

IOI Aliens - Walkthrough

The hardest application

Cover points with at most KK squares. Find the lowest total area. The iconic problem that named the trick. Preprocess: reduce to covering intervals.

Some intervals dominate others. Reduce to O(N)O(N) needed intervals. DP: dp[i]dp[i] = min cost to cover first ii intervals. Transition: pick where last square starts. Apply CHT. Aliens trick: penalize each square by λ\lambda. Binary search to use exactly KK. Total: O(NlogNlog(cost))O(N \log N \log(\text{cost})).