WA answer in SNAKEEAT old snackdown problem.. if anyone solved this pls check my code

solution
https://www.codechef.com/viewsolution/22975166