Блог пользователя Fearless_cod

Автор Fearless_cod, история, 3 года назад, По-английски

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.

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

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)