|
|
back to boardShow all messages Hide all messagesTime Limit Exceeded Test#12 what do? I think we only remember 1 to 2^i this mean G(1,i) then F(1,N]=F(1,2^i)+i-1+F(2^i+1,N) ==> F(1,N)=G(1,i)+i-1+F(2^i+1,N) while the last F(2^i+1,N)=F(1,N-2^i-1) and so on certainly f(1,1)=0; Edited by author 04.05.2013 19:28 I just use something like low_bit and calc the answer easily in logN time. You may use Abs(Dis(1,A) - Dis(1,B)) it is a good way to solve this problem. Sorry for my poor English. Edited by author 14.11.2005 21:19 15 strings - And AC - Cool!!! - time 0.015 |
|
|