Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Harvesting Without Breaking

โญโญโญ advancedโณ 13 min read๐Ÿ“ Lesson 235 of 281

One submission can serve every band: special-case the small inputs, run the heavy path only when needed โ€” and never let the upgrade break the harvest.

Harvesting Without Breaking

The professional partial-score submission is one program with tiers:

read n, the values
if (n <= 20)      โ†’ run brute force, output, exit
if (n <= 2000)    โ†’ run O(nยฒ), output, exit
run full solution

Each tier is independently testable; a bug in the full solution cannot destroy the n โ‰ค 20 points if the tier exits before the heavy path runs.

Tier discipline

  • Tier order = band order. Ship and verify the easiest tier first.
  • Shared input parsing. Parse everything once, correctly; most tier bugs are actually parsing bugs (the tier never sees the real input).
  • The upgrade rule. When adding tier k+1, re-run tier k's tests. The most expensive contest mistake is a refactor that silently breaks the guaranteed points.
  • Fallback ladder. If the full solution TLEs on the real test, the tiers above it still answered โ€” partial scoring rewards programs that degrade gracefully.

Honesty

Never special-case the sample tests themselves. Hard-coding sample outputs is detectable, worth zero learning, and trains exactly the wrong instinct. Specialize on constraint shapes, not on the sample files.

โšก Now practice

Ready to Code
Partial Scoring DrillsThree drills: band-value arithmetic, degenerate-band specialization, and the upgrade rule.
3 challenges ยท ยท ~20 min