input format 1@10@-1#10@2@10#-1@10@-1 @ for different column element And # for new row output 2
Two cities X and Y (Both should be green in color) can communicate with each other if they are directly connected to each other or they are connected to cities X1 and Y1 respectively such that X1 and Y1 are connected. Two cities are said to be directly connected if they share an edge or a corner. So city at (3,1) can communicate to city at (2, 1), (1, 1), (1, 2), (2, 2) and (4, 2). These all connected parts cumulatively form a communication zone. government can satablize communication in red regions but it would cause some cost and every red every red region may have a different cost. in fact there is no use of stablizing red zones communication because they are very less populated area. government concern is to connect the various communication zones. challange is to connect various communication zone in least possible cost.