shivam_360's blog

By shivam_360, history, 4 months ago, In English

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....

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By shivam_360, history, 8 months ago, In English

can anyone explain this why https://codeforces.com/contest/18/submission/172558206 this solution gets accepted while https://codeforces.com/contest/18/submission/172557506 this is giving wrong answer for problem https://codeforces.com/contest/18/problem/C

Isn't both the same thing??

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

By shivam_360, history, 9 months ago, In English

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

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it