speedster's blog

By speedster, history, 7 years ago, In English

problem : in a rooted binary tree with n nodes, each node has a positive value( v(i) ) you need to select k(k<=n) nodes from the tree. if a node is selected you must select all of its ancestors.design a dp algo for maximum possible value of k selected nodes

Full text and comments »

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

By speedster, history, 9 years ago, In English

How to solve this: given multiple query of type : x l r , we need to find the frequency of x in the range r to l. There are no updation so basically calls out for an offline algorithm .

Full text and comments »

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

By speedster, history, 9 years ago, In English
  • Vote: I like it
  • +1
  • Vote: I do not like it

By speedster, history, 9 years ago, In English

Hello codeforces community . I was stuck in this problem was quite sometime . So decided to view the editorial . LINK . I completely understood the editorial but having a hard time understanding why it works . What is the reason behind this. I'll try to explain the method: — we will start will smallest a[i] and for each a[i] we will run a loop from ( j= 2*a[i] till 2*maximum_element_of_array with increment of a[i] (just like sieve) at each j we will find the number which is JUST less than this j present inside the array .If this number j compares greater than a[i] we will store the result in the variable ans . REFERENCE SOL Thank you . plz help me out :)

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By speedster, history, 9 years ago, In English

Hey, I want to know the thought process of dynamic programming from highly rated users. Do you always start with recursion ? how do you decide the state of dp ( biggest mystery of my life currently ) .

Full text and comments »

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

By speedster, history, 10 years ago, In English

I have been trying to solve This problem unable to do it i looked at the solution but can't understand how this why is taking a factor of 2 helping ?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By speedster, history, 10 years ago, In English

Recently my topcoder arena stopped working with the message "Unable to launch the application " I tried everything from re-installing the arena to java update to clear cache . nothing worked . Then at last i opened arena.topcoder.com but I don't know how to get my kawigiedit editor to work in it. Any idea ?

Full text and comments »

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

By speedster, history, 10 years ago, In English

How can we prove this : no of unique outputs to (i*j)%k where i can be any number j and k are known is k/__gcd(k,j);

Full text and comments »

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

By speedster, 10 years ago, In English

Hello , I was trying to solve O2J ladder for bipartite matching but got stuck in HERE I know this is bipartite matching but I am unable to figure out what would the vertices in set1 represent and similarly what would the vertices in set2 represent . A hint would be appreciated .

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it