22826_SimplePolygon

2022-5-16 18:23| 发布者: Hocassian| 查看: 17| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506994798400-Problem List-采集的数据-后羿采集器.html

Pro.ID

22826

Title

Simple Polygon

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22826

AC

0

Submit

13

Ratio

0.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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 ≤ 2000), 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 -10000 to 10000, inclusively.

    输出

    Description

    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.

    Input

    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 ≤ 2000), 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 -10000 to 10000, inclusively.

    Output

    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.

    Sample Input

    2
    4 0 0 2 0 0 1 1 0
    5 0 0 10 0 10 5 5 -1 0 5

    Sample Output

    0 3 1 2
    3 1 2 4 0

    Source

    样例输入

    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

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部