ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1117. Hierarchy

manishmmulani pls pls pls pls pls help... how to store so many numbers [2] // Problem 1117. Hierarchy 29 Dec 2007 20:10
for the range 1 to 2^31-1 even O(n) soln won't work
i.e even a single loop will take more time

if we want to use f(n,m) = abs(f(1,n)-f(1,m))

we need to store 2^31 values... how is it possible to store so many numbers!!!!
You don't need to store so many numbers. Tey to find another way (try to see how change length between fixed nodes). f(n,m) = abs(f(1,n) - f(1,m)) - it's ok.
ok thanx .. will try it