The game of grid

Problem Name:
The game of grid
Site:HackerEarth
Links:
Tags:
Problem setters: