← All problemsSign in

Restore the Recipe

CodeChefRating 2196Open on judge ↗

Chef has had a recipe. He had written it as a sequence of N integer numbers A[1], A[2], ..., A[N]. To be on the safe side, he decided to write out M triples of numbers, where i-th triple is composed of three numbers Xi, Yi and Zi. It means that the sum of numbers in the recipe from Xi-th to Yi-th is equal to Zi. In other words, A[Xi] + A[Xi + 1] + ... + A[Yi] = Zi. Unfortunately, the recipe has be

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