sort-preprocessing-universally-correct

Status: OUT

Sort-then-scan preprocessing produces correct results across all solutions that use it, because sorting establishes exactly the adjacency and monotonicity invariants that the subsequent linear scan requires for correctness.

Justifications

Sort preprocessing is correct by construction — UNLESS the sort comparison function cannot distinguish elements that must be ordered differently (as when duplicate heights cause tuple comparison to fall through to names)

Depends on (SL): sort-preprocessing-enables-linear-scan, correctness-by-construction-not-validation

Unless: sort-people-assumes-distinct-heights

JSON