Skip to main content

Practice · 6 of 6

Final 6: The Bookings

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** A hall accepts booking requests i = (s[i], e[i], w[i]): the event would occupy the half-open interval [s, e) and pays w. Accept any subset of pairwise non-overlapping bookings (one event may start exactly when another ends); maximize total payment. **Constraints:** 1 ≤ n ≤ 100000; 0 ≤ s < e ≤ 10^6; 1 ≤ w ≤ 1000. **Input:** line 1: n; then n lines: s, e, w. **Output:** one integer.

Back to lesson: Practice: The Final Pack