Skip to main content

Practice · 1 of 2

Editorial Problem 1: The Stalls

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** A market has n stalls in a row; stall i brings a[i] revenue. Security forbids operating two *adjacent* stalls. Choose a subset of non-adjacent stalls with maximum total revenue; print it. **Constraints:** 1 ≤ n ≤ 200000; 0 ≤ a[i] ≤ 10^9. **Input:** line 1: n; line 2: n values. **Output:** one integer.

Back to lesson: Practice: Editorial Problems and Variations