Fearless_cod's blog

By Fearless_cod, history, 3 years ago, In English

In** problem E** of yesterday's round, I misread the question and thought of a completely different problem the whole time. But this problem might also be interesting for some of you guys. So, here goes the modification:- Instead of swapping any two elements, you can swap only two adjacent elements and the constraint on m is m<=n.

I can share my idea and code also for this problem which I think works. Meanwhile, if any of you guys know any links where we can submit this problem, please share it.

Thanks for reading.

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Fearless_cod (previous revision, new revision, compare).

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Fearless_cod (previous revision, new revision, compare).

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I also did the same misread, the problem was nice that way too :)

»
3 years ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

since all element are distinct, no of adjacent swaps required to convert array A to array B, can be done using counting inversions on the modified array A' (A' can be calculated by array A and B)