← All problemsSign in

Range Updates and Sums

CSESRange QueriesOpen on judge ↗

Your task is to maintain an array of n values and efficiently process the following types of queries: - Increase each value in range [a,b] by x. - Set each value in range [a,b] to x. - Calculate the sum of values in range [a,b]. Input The first input line has two integers n and q: the array size and the number of queries. The next line has n values t_1,t_2,\dots,t_n: the initial contents of

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start