← All problemsSign in

Yet Another SubSegment Sum Problem

You are given two arrays A and B, each consisting of N integers. You are also given M queries of the form Lj Rj Cj Dj. For each of these queries, we ask you to calculate the value of the sum of max{0, Ai × Cj - Bi × Dj} over i from Lj to Rj. This is an on-line problem, so you won't get the next query unless you answer the current one. Input The first line of the input contains an integer N

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