NEED OPTIMAL SOLUTION

Revision en2, by AJ__20, 2023-05-30 17:40:14

I was given a question with integer array A of size N, And asked to find answer for Q queries. Each query consists of (L, R, Min, Max). One need to find the minimum sum in the given range(L, R) with atleast 'Min' element and atmost 'Max' elements should be in the minimum sum. Constraints : 1 <= N <= 1e5, 1 <= Q <= 1e5, 1 <= Testcases <= 1e5. I tried brute force approach and got TLE. I searched the internet for the optimal approach and couldn't find the answer, so could anyone explain how to approach this problem?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English AJ__20 2023-05-30 21:14:38 96
en2 English AJ__20 2023-05-30 17:40:14 32 (published)
en1 English AJ__20 2023-05-30 17:38:30 544 Initial revision (saved to drafts)