Comments

Hey everyone, I need some help. In the Bonus Section of Problem 2101B — Quartet Swapping, It's given: "Do you know how to count the parity of inversions without counting the number of inversions?" Can anyone help me out with this?

Thank you guys for providing the solution. I was trying entirely different approach. Everytime I come across undesirable condition i.e. b(j)>a(i), I tried to use magic and kept track of index for which it's been used and then releasing this magic if possible for future. This is where I got stuck, couldn't implement it nicely.

https://codeforces.me/contest/2106/submission/317067927

Am I completely wrong or is it doable like this? Ofc needs some improvement in Check function.

For problem D, Can we do binary search on the beauty of flower that needs to be inserted? I was trying to solve it this way but WA on Test case 2.