Hi, I have been trying to solve this problem for a very long time now. But getting WA. Can anyone please check out my code and tell me what's wrong with it?
Problem link: https://icpcarchive.ecs.baylor.edu/external/69/6982.pdf
My code: http://ideone.com/ti6xRi