当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3850:Simple Polygon

Special Judge 特殊评判
题目描述
Write a program that constructs a polygon from a given set of points in the plane. Each point of the set has to be a vertex of the polygon, and the polygon must not have any other vertices. No two line segments of the polygon may have any point in common, except for the middle vertex of two consecutive line segments. For example, given the points on the left-hand side, a valid polygon is shown on the right-hand side:

A valid polygon is guaranteed to exist, and any valid polygon will be accepted as a correct answer. Moreover, no two points will share the same location, and not all points will be collinear.
输入解释
The first line of the input consists of an integer c (1 <= c <= 200), the number of test cases. Then follow the test cases, one per line.
Each test case starts with an integer n (3 <= n <= 2 000), the number of given points. Then follow, on the same line, the coordinates of the points. Each point is specified by two integers x and y in the range -10 000 to 10 000, inclusively.
输出解释
For each test case, print a single line containing a permutation of the numbers 0 to n-1. Each of these numbers represents the index of a point, in the same order as given in the input. When drawing line segments between consecutive points in the order given by this permutation, the result must be a valid polygon.
输入样例
2
4 0 0 2 0 0 1 1 0
5 0 0 10 0 10 5 5 -1 0 5
输出样例
0 3 1 2
3 1 2 4 0

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3850

最后修改于 2020-10-29T07:13:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536