hi , i solved it using the modified merge sort routine, but i'm getting WA. Can u plz help me with some test cases?
code: http://ideone.com/9kYz5 On Apr 10, 9:00 pm, Anurag Gupta <anurag.gupta...@gmail.com> wrote: > you dont need that much to do this problem > > modify merge method in mergesort to calculate the sum in nlgn > think about it it's quite easy > > you must have heard of Count Inversion problem , this is similar to that > problem > > On Tue, Apr 10, 2012 at 6:49 AM, bharath kannan <bharathgo...@gmail.com>wrote: > > > > > > > > > > > I dont know if it can be solved in O(n). But O(nlogn) can be done using > > BIT. Refer topcoder tutorial for Binary indexed trees. > > > On Mon, Apr 9, 2012 at 10:56 AM, tarun chabarwal > > <admin20...@gmail.com>wrote: > > >> how should i approach this problem.... > >>https://www.spoj.pl/problems/DCEPC206/ > >> can it be solved in O(n)..? > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to algogeeks@googlegroups.com. > >> To unsubscribe from this group, send email to > >> algogeeks+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/algogeeks?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > Regards > Anurag Gupta > III Year Computer Engineering > Delhi Technological University > (Formerly Delhi College of Engineering) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.