1 人解决,8 人已尝试。
1 份提交通过,共有 15 份提交。
9.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
In this problem, we will help the Faculty of Civil Engineering. They need a software to analyze ground plans of buildings. Specifically, your task is to detect outlines of a building when all of its corners are given.
You may assume that each building is a rectangular polygon with each of its sides being parallel either with X or Y axis. Therefore, each of its vertex angles is exactly either 90 or 270 degrees.
The input contains several buildings. The description of each building starts with a single positive integer N , the number of corners (polygon vertices), 1<=N<=1000 . Then there are N pairs of integer numbers Xi, Yi giving coordinates of individual corners, | Xi|,| Yi|<=10000 .
You may assume that all corners are listed and no two of them have the same coordinates. The polygon does always exist, it is closed, its sides do not intersect or touch (except neighboring sides, of course), and it contains no “holes” inside. In other words, the outline is formed by one closed line. The order of corners in the input file may be arbitrary.
There is an empty line after each building, then the next one is described. After the last building, there is a single zero that signals the end of input.
For each building, output one line containing N characters without any whitespace between them. The characters should be uppercase letters that specify directions of individual walls (sides) when the building outline is followed. “N” stands for North (the positive direction of the Y axis), “E” for East (the positive direction of the X axis), “W” for West, and “S” for South. The “walk” should start in the vertex that has been given first in the input and always proceed in the clockwise direction.
The second sample input corresponds to the picture.
4 0 0 2 2 0 2 2 0 6 1 1 2 2 0 1 1 0 0 2 2 0 0
NESW WNESWN
1 人解决,8 人已尝试。
1 份提交通过,共有 15 份提交。
9.9 EMB 奖励。