2689. Find the border

单点时限: 2.0 sec

内存限制: 256 MB

Closed polyline (with possible self-intersections) partitions a plane into a number of regions. One of the regions is unbounded — it is an exterior of the polyline. All the bounded regions together with the polyline itself form an interior of the polyline (shaded in the picture below). The border of the interior (bold line in the picture) is a polyline as well. This polyline has the same interior as the original one. Your task is to find the border of the interior of the given polyline.

To guarantee the uniqueness (up to the starting point) of the polyline representing the border we require that the following conditions are satisfied for it:

  • it has no self-intersections, although may have self-touchings;
  • no adjacent vertices of the border coincide;
  • no adjacent edges of the border are collinear;
  • when traversing the border, its interior is always to the left of its edges.

输入格式

The first line of the input file contains an integer number $n$ ($3 \le n \le 100$) — the number of vertices in the original polyline. Following $n$ lines contain two integer numbers $x_i$ and $y_i$ on a line ($0 \le x_i, y_i \le 100$) — coordinates of the vertices. All vertices are different and no vertex lies on an edge between two other vertices. Adjacent edges of the polyline are not collinear.

输出格式

Write to the output file an integer number $m$ — the number of vertices of the border. Then write $m$ lines with coordinates of the vertices. Coordinates must be precise up to $4$ digits after the decimal point.

样例

Input
10
4 9
9 9
12 4
10 2
9 5
14 10
14 5
10 9
11 4
4 4
Output
13
4.0000 4.0000
9.3333 4.0000
10.0000 2.0000
12.0000 4.0000
10.5000 6.5000
11.5000 7.5000
14.0000 5.0000
14.0000 10.0000
11.5000 7.5000
10.0000 9.0000
10.5000 6.5000
9.0000 9.0000
4.0000 9.0000

0 人解决,2 人已尝试。

0 份提交通过,共有 2 份提交。

9.9 EMB 奖励。

创建: 14 年,9 月前.

修改: 6 年,9 月前.

最后提交: 1 年前.

来源: NEERC 2004

题目标签