Data Structure problem: Range variable update and range queries

Revision en1, by yashagarwal082, 2015-10-04 17:25:30

Suppose you have been given two arrays of length N ( 1 < N <= 100000), say A[1 .. N] & B[1 .. N], Now you have to output another array, C[1 .. N] such that: C[i] = A[i] + min(C[j] — B[j] * B[i]) for all 0 <= j < i. Note: C[0] = A[0] for example : Suppose A = [3, -1, 4, 5, 10] and B = [2, 5, 1, 9, 1]

Ranges : 0 < N < 100000 -10^9 <= A[i] <= 10^9 0 < B[i] < 10^7

Tags data structures, segment tree, range query

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English yashagarwal082 2015-10-04 18:01:59 42
en2 English yashagarwal082 2015-10-04 17:51:07 521 Tiny change: '= j '= j (published)
en1 English yashagarwal082 2015-10-04 17:25:30 448 Initial revision (saved to drafts)