11760 - Brother Arif, Please feed us!
Solution Description : Ad hoc problem If Arif position (x,y) Then 5 escape positions for Arif are (x,y) (x-1,y) (x+1,y) (x,y-1) (x,y+1) Now check each position of other programmer -----Suppose the programmer position is (Xi,Yi) -----If Xi is match any first value of escape position then the cell is block. i.e. if Xi=x-1 then cell (x-1,y) is block. -----If Yi is match any second value of escape position then the cell is block. i.e. if Yi=y+1 then cell (x,y+1) is block. At last is all 5 escape position (cell) are block then print "Party time! Let's find a restaurant!" Otherwise print "Escaped again! More 2D grid problems!" |
||||||||||