Subsegment Sum
Given an array A = A1, A2, ..., AL and queries of 2 types: - Type 1 - represented as 1 i v meaning that you have to change Ai = v (change is carried on for further queries too) - Type 2 - represented as 2 and explained below A subsegment Al, Al+1, ..., Ar, is called interesting, if for all i, such that l Ai is either equal to Ai-1, or it is equal to Ai-1 + 1. A subsegment of length 1 is a
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start