877 - Offset Polygons
Posted: Fri Aug 12, 2005 12:31 pm
Although this looks like an easy problem, I fail to get AC (as many others, looking at the stats).
My approach is simple:
- shift all edges offset to the left;
- calculate the intersections of the shifted edges.
This means that the new polygon always has the same number of edges/vertices as the old one. I print the co-ordinates with three digits after the decimal dot.
Anything I overlooked? Or is it simply a matter of precision? Without the proper output specification, I think this problem should have a special corrector.
BTW, I assume that the input follows the input description (max. 8 vertices, min. 3, clockwise, convex, etc.) without checking or correcting.
My approach is simple:
- shift all edges offset to the left;
- calculate the intersections of the shifted edges.
This means that the new polygon always has the same number of edges/vertices as the old one. I print the co-ordinates with three digits after the decimal dot.
Anything I overlooked? Or is it simply a matter of precision? Without the proper output specification, I think this problem should have a special corrector.
BTW, I assume that the input follows the input description (max. 8 vertices, min. 3, clockwise, convex, etc.) without checking or correcting.