CustomCC0-1.0#ct-p6-062420
Hybrid Query Engine
Summary
- •Phase 6 / combined-techniques
- •Reasoning-first competitive programming drill
Problem Description
Mixed operations: point update, subtree sum query, path max query. Design a unified structure.
How to read this problem in plain language:
- This is a Phase 6 reasoning drill focused on combined-techniques.
- Typical lenses to test first: heavy-light, segment-tree, euler-tour.
- Constraints reminder: n,q <= 2e5
Mini examples for mental simulation:
1) Boundary example: Should cover full array interval. Explain expected behavior and why naive logic may fail.
2) Adversarial example: Path max equals node value. Explain expected behavior and why naive logic may fail.
Lite-mode writing target:
- Write 1~2 observations that shrink the search space.
- Name one final algorithm and state target complexity explicitly.
- Validate with at least 2 edge cases and one hand simulation.
Constraints
- •n,q <= 2e5
Analysis
Key Insight
Path query needs chain hopping; subtree query O(log n).
heavy-lightsegment-treeeuler-tour