← All problemsSign in

Subarray Sum Constraints

CSESAdditional Problems IOpen on judge ↗

Your task is to construct an array x_1,x_2,\dots,x_n consisting of n integers. The array must satisfy m constraints of the form (l,r,s): the sum x_l + x_{l+1} + \dots + x_r must equal s. Input The first line has two integers n and m: the length of the array and the number of constraints. The next m lines each have three integers l, r and s: the description of the constraints. Output If a sol

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