res_and_ser's blog

By res_and_ser, history, 6 years ago, In English

Hello everyone, I was practicing a problem from

interview bit — https://www.interviewbit.com/problems/kth-smallest-element-in-tree.

Here is my code for the same.

I don't know why I am getting wrong answer with this even though it shows correct output when I try to debug it.

Please help.

Full text and comments »

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

By res_and_ser, 6 years ago, In English

Hello codeforces community,

Is there anyone who has proper implementation of wavelet tree? I am having a hard time coding it.

I tried using the code mentioned below but its giving runtime error.

Code — https://ideone.com/Tkters

Full text and comments »

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

By res_and_ser, history, 6 years ago, In English

Can anyone tell me how to implement this in C++.

A segment tree which finds range min query and on each update makes all the elements in a range equal to x.

Basically for two type of queries, it does this ;

1 l r means to find the min number from l to r

2 l r x means to make all the numbers in the array equal to x within range l to r.

Thank you in advance.

Full text and comments »

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

By res_and_ser, 6 years ago, In English

Hello codeforces

I recently encountered this problem in an interview.

You have an infinite grid. You know the value of m and n and you need to find number of paths from (0 , 0) to (m , n) with condition that you are allowed to move up, down, left and right.

How to do this?

Full text and comments »

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

By res_and_ser, 6 years ago, In English

Hello all

Can anyone tell me how to solve this problem?

Query 1 — Equate all elements in range l to r equal to x

Query 2 — Find sum of all the elements from range l to r.

Constraints : n  <  =  100000

Full text and comments »

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

By res_and_ser, history, 6 years ago, In English

Can anybody tell me logic behind 4th problem in ACM ICPC India Online round?

I tried but I failed to solve it :(

Full text and comments »

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