link to question — https://www.codechef.com/problems/CHEFINV
MY APPROACH -
using a mergesort tree
find swaps decreased and increased for A[L] due to L-R
find swaps decreased and increased for A[R] due to L-R
calculate answer
complexity — Mlog^n?
my code — https://ideone.com/tgs2nU
i also tried testing my code against one of the AC codes still couldnt find my mistake. any help would be appreciated!
I think in this kind of blog, problem link should be available. And most importantly your code is not given as link. I am green only and I do not know anything about mergesort tree, so I really won't understand you approach. But those who know and would be kind enough to help you will face problem. They can also lose interest seeing such an unorganized blog where they have to copy and paste the link of your code.
i tried the approach you said in earlier questions and still got > 10 downvtes and no answers...**i ultimately delete the entry** and get answers to my questions 1 in 20 times..
in fact in an earlier blog i received the exact opposite review i.e. post the question and not the link
also, its a codechef question as i said and if you google the title the first link will be the question
thanks a lot though!