Problem on Queries

Правка en3, от karanmishra8997, 2018-09-09 12:38:02

I have an array A of N elements (1 <= N <= 200000). Now I have Q (1 <= Q <= 200000) queries. In each query, 3 integers x, l and r are given. I have to find min{x*j + A[j]} where l <= j <= r. I was thinking about solving this by segment tree or dynamic programming but still I can't handle proper time complexity. Example: Input Array A = [12, 13, 33, 25, 10, 41, 51, 2]. Query: 2 1 5 Output: 14 Query: 5 5 8 Output: 35. Can anybody tell me the right approach?

Теги #segment tree, #dp, #dynamic-programming, queries

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский karanmishra8997 2018-09-09 12:38:02 6
en2 Английский karanmishra8997 2018-09-09 12:37:38 23
en1 Английский karanmishra8997 2018-09-09 12:36:15 486 Initial revision (published)