Replace activated edge for point (r,c) . That is if the edge to the point (r+1,c) is activated, then instead of it, the edge to the point (r+1,c+1) becomes activated, otherwise if the edge to the point (r+1,c+1) , then instead if it, the edge to the point (r+1,c) becomes activated. This action increases the cost of the path by 1