coco_elon's blog

By coco_elon, history, 8 years ago, In English

I found this question in Codeforces Round #373 (Div. 2).

http://codeforces.net/problemset/problem/719/B

My solution:

https://ideone.com/RYOQkS

Can someone please help me find why my solution fails and how to correct it accordingly?

Thanks in advance!

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

"he can either swap any two cockroaches". Did you notice this line? Not necessarily two cockroaches should be adjacent to swap. I did the same mistake though :(