Блог пользователя shivam_360

Автор shivam_360, история, 17 месяцев назад, По-английски

You are given an array a of length n and q queries... A query is in the form [l,r,x].. First, you need to replace each a[i] with a[i]^x for each i from l to r and then answer for the query will be bitwise OR of all a[i] for each i from l to r... here the changes of each query will permanently reflect in the array...and every time we process on the updated array... constraints: N and q <=10^5 A[i] and x <=10^9 L<=r<=N

suggest some of the possible way to approach this problem and some of intuition for in general solving this type of range update questions.... i think...some kind of segment tree or BIT solution must be there...

Полный текст и комментарии »

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится

Автор shivam_360, история, 18 месяцев назад, По-английски

we have given with an array of coordinate pairs in the form of (x,y) and an integer k, we have to find the number of pairs such that ((x1^x2)+(y1^y2))=k where (x1,y1) is first pair and (x2,y2) is second pair... also i<j, assume the length of the input array to be 10^5 and k can go up to 100..

i know it's some kind of map question where we have separate the relationship in form of x1,y1 and x2,y2 independently...but not able to come up with such relationship... can someone help me with some good approaches and also the intuition behind it... thank you!!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -25
  • Проголосовать: не нравится

Автор shivam_360, история, 22 месяца назад, По-английски

we are given with an array of n integers n<=10^5 , we need to answer q queries q<=10^5 , in each query we are given with l,r and an integer x, for each query we need to answer the summation of |a[i]-x| for all i>=l && i<=r (summation of absolute difference of each number with x in range l and r)..as constraints are big we need to solve each query in less than n... Can anyone suggest some approach with some thought process....

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор shivam_360, история, 2 года назад, По-английски
  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

Автор shivam_360, история, 2 года назад, По-английски

can anyone suggest some good resource to learn the basic concept and implementation of sparse table?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится