Shameek's blog

By Shameek, 4 years ago, In English

link to question — https://www.codechef.com/problems/CHEFINV

MY APPROACH -

  1. using a mergesort tree

  2. find swaps decreased and increased for A[L] due to L-R

  3. find swaps decreased and increased for A[R] due to L-R

  4. 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!

  • Vote: I like it
  • -2
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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!