Editorialist’s solution is commented.
Used the same approach as of tester but the code is throwing Segmentation fault. Unable to debug the cause. Can anyone help?
Solution Link:
[1]
[1]: https://www.codechef.com/viewsolution/17193387
Check for i>0 before accessing its neighbours.
please someone find error in my code i ran few test cases but that are fine
Figured it out last night. Still thank you. Silly mistake!