Slope Trick Ladder¶
This ladder is for the exact convex-function DP lane where:
- the state is one convex piecewise-linear function
f(x) - one update adds a hinge like
max(0, x-a)ormax(0, a-x) - and movement sometimes widens the minimizer interval
Who This Is For¶
Use this lane if:
- you can already define the DP state as "best answer when ending at coordinate
x" - the state remains convex in that coordinate
- the next step is no longer generic state design, but function maintenance
This lane is intentionally narrow:
- one exact starter
- one flagship in-repo rep with
shift_min - one warm-up compare point where the same family is lighter
Warm-Up¶
- repeated
f(x) += |x-a| + bplus query for one minimizer -> AtCoder ABC127 F - Absolute Minima
Target skill:
- recognize when plain median maintenance is the lighter route inside the same convex-function family
Core¶
- exact starter ->
slope-trick-basic.cpp - exact flagship -> Snuketoon
Target skill:
- map each contest event to one of:
add max(0, x-a)add max(0, a-x)add |x-a|shift_min
Stretch¶
- movement + absolute-distance variant -> AtCoder ABC406 G - Travelling Salesman Problem
- monotone-sequence convex DP follow-up -> AtCoder ARC163 F - Many Increasing Problems
Target skill:
- distinguish "same slope-trick machinery, different recurrence skin" from genuinely different optimization families
Retrieval Layer¶
- exact quick sheet -> Slope Trick hot sheet
- exact starter ->
slope-trick-basic.cpp - parent DP retrieval -> DP cheatsheet
- broader route -> DP ladders
Repo Anchors And Compare Points¶
- topic page -> Slope Trick
- parent DP worldview -> DP Foundations
- compare affine family -> Convex Hull Trick / Li Chao Tree
- compare lighter same-family route -> AtCoder ABC127 F - Absolute Minima
- flagship rep -> Snuketoon
The cleanest in-repo loop here is:
- learn the exact operations from the Slope Trick topic
- trust the starter through Snuketoon
- compare back against
Absolute Minimaso "slope trick vs lighter median route" becomes real
Exit Criteria¶
You are ready to move on when:
- you can explain why the state stays convex
- you can translate a transition into one hinge or one
shift_min - you can say when
Absolute Minimais the lighter same-family route - you can say why CHT / Li Chao is a different family
External Practice¶
- AtCoder ABC127 F - Absolute Minima
- AtCoder ABC217 H - Snuketoon
- AtCoder ABC406 G - Travelling Salesman Problem
- AtCoder ARC163 F - Many Increasing Problems