Skip to main content

Practice · 3 of 5

Windows At Least S

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** Given n positive integers and a threshold S, count the contiguous segments whose sum is **at least** S. **Constraints:** 1 ≤ n ≤ 200000; 1 ≤ a[i] ≤ 10^9; 1 ≤ S ≤ 10^18. **Output:** one integer (fits in long long). With all-positive values the window boundaries are monotone — use that.

Back to lesson: Practice: Observation Drill — Five Hidden Structures