PROBLEM LINK:Author: Manish Kumar Sinha DIFFICULTY:EASYMEDIUM PREREQUISITES:Geometry, Linesweeping PROBLEM:Given the corners of a number of polygons, calculate the area and perimeter of the polygon. Also the sides of polygons are parallel to Xaxis and Yaxis and none of the polygons intersect. EXPLANATION:First thing to observe that sides are parallel to the coordinate axes and polygons are non intersecting, so at a particular value of X or Y, there must be even number of points. So take a vertical line to sweep and maintain active set of points with y ordinate only. At a particular value X, first count the number of points, if it is odd then given region cannot be closed, hence print "Impossible". Otherwise calculate the area till this X, by iterating through the points in active set. Calculating Area till X:
i += 2; For calculating the perimeter, we have to sweep first using vertical and hen horizontal line. For a vertical sweep line, at a particular X, if we find a point having y ordinate already in the active set, then this a side of a polygon, hence add its length to the perimeter. For vertical sweep line, all the sides which are parallel to xaxis will be added to the perimeter. So for sides parallel to Yaxis, sweep horizontal line and do same. SOLUTION:asked 10 Nov '16, 16:01

On following Setter's Solution link, the page says Access Denied. Is that for everyone or just me ? answered 07 Jun '17, 15:38
