Rare
 0/12

LineContainer

Authors: Benjamin Qi, Andi Qu

Convex Containers

Half-Plane Intersection

This section is not complete.

Feel free to file a request to complete this using the "Contact Us" button.
Example problem + implementation?
StatusSourceProblem NameDifficultyTagsSolutionURL
KattisNormalView Solution
JOIHardView Solution
Balkan OIVery Hard
Show Tags

Geometry, Binary Search

External Sol

LineContainer (aka CHT)

StatusSourceProblem NameDifficultyTagsSolutionURL
YSNormalView Solution
Resources
KACTLsource of code that I (Ben) use
cp-algorelated topic (but not the same)

Example Problem

Focus Problem – read through this problem before continuing!

Analysis

Instead of focusing on the pillars that should be destroyed, let's instead focus on the pillars that remain.

The total cost consists of the cost due to height differences plus the cost of destroying unused pillars. The latter cost is equal to the cost to destroy all pillars minus the cost to destroy the remaining pillars.

Since the cost to destroy all pillars is constant, we can thus turn the problem into one about building pillars instead of destroying them!

From this, we get a basic DP recurrence. Let be the minimum cost to build the bridge so that the last build pillar is pillar .

and the following recurrence holds:

Notice how

effectively describes a linear function , where , , and

This means that we can use CHT to compute efficiently!

However, since is not monotonic, we can't use linear CHT using a deque, so we must settle with .

Code

Problems

StatusSourceProblem NameDifficultyTagsSolutionURL
YSNormalView Solution
POINormal
Show Tags

DP, convex

View Solution
CEOIHard
Show Tags

DP, convex

External Sol
FHCHard
Show Tags

DP, convex

Check FHC
ACHardCheck AC
TLXHardCheck TLX
Old GoldHardExternal Sol

Module Progress:

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!

Give Us Feedback on LineContainer!