Thursday, 2 April 2015

CODEFORCES ROUND 297 Div. 2 ( Pasha and String )


Problem Link

Go Greedy!!!

Main Idea is that you go in any order , the swaps will not change.
Swap and Unswap totally depends on the total swap at that position

So , First just mark the swaps at each positon.

Then , sum them to get the total swaps at each position

Now if swap sum count is odd then swap otherwise not

This is one of the finest problem i had seen on greedy basic !!

No comments:

Post a Comment