1 / 4
Aug 2017
5 years later

did you got the solution - pls share…
i understood this problem requires us to do preprocessing so when we query - we can use pre created vector which stores the sum of flowers starting from node V to node U(ancestor of V)

but can’t do this for each pair (U,V) so i think we should only do this for each pair (1,x) - and such vector for (U,V) can be written in terms of (1, V) , (1, U) and we can use binary search to find index where our suffix sum become greater than required

but how to handle point updates ?

23 days later

problem is very simple u have given condition u have to find the d( date ) and m(month) of a particular individual
make a new method or function given the following condition and in the main class call the function and pass the parameter d and m its done