21917_BuggySa

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

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

Pro.ID

21917

Title

Buggy Sat

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Discovery Co. ltd. builds a satellite using a new kind of an intelligent camera. The camera has special software to detect cities and roads from an image, and is also able to detect every region (which is a connected part of surface), bounded by a series of connected roads with no other region inside. Using this technology, the satellite is able to compress the picture before sending it. The compressed format of a picture is the city locations and its regions.

    Discovery has launched the satellite, without testing the software completely. So, after a while, they received some buggy pictures which includes one more extra region: the outer region. The outer region is the region of the plane enclosing every other region (which has infinite area). Further analysis shows that all images sent have the following properties:

    1. All cities, in the image, have at least two roads to the other cities.

    2. There is a path connecting every pair of cities.

    3. There is at most one road between each pair of cities.

    4. Roads do not cross each other except at the cities.

    The above Figure shows a sample image received (see sample input).

    You are to write a program to read a buggy image and report the outer region.

    输入

    The first line of the input consists of a single integer N ( 1 ≤ N ≤ 20 ), which is the number of test cases. The test cases appear with no blank lines in between. The first line of each test case consists of the number of cities (between 1 and 50) followed by pairs of integers (x, y) which are location of cities (each pair in one line), followed by number of faces in a separate line (between 1 and 50), followed by face information on each line. Face information consists of number of cities making the face and the city numbers in clockwise (or counterclockwise) order.

    输出

    Description

    Discovery Co. ltd. builds a satellite using a new kind of an intelligent camera. The camera has special software to detect cities and roads from an image, and is also able to detect every region (which is a connected part of surface), bounded by a series of connected roads with no other region inside. Using this technology, the satellite is able to compress the picture before sending it. The compressed format of a picture is the city locations and its regions.

    Discovery has launched the satellite, without testing the software completely. So, after a while, they received some buggy pictures which includes one more extra region: the outer region. The outer region is the region of the plane enclosing every other region (which has infinite area). Further analysis shows that all images sent have the following properties:

    1. All cities, in the image, have at least two roads to the other cities.

    2. There is a path connecting every pair of cities.

    3. There is at most one road between each pair of cities.

    4. Roads do not cross each other except at the cities.

    The above Figure shows a sample image received (see sample input).

    You are to write a program to read a buggy image and report the outer region.

    Input

    The first line of the input consists of a single integer N ( 1 ≤ N ≤ 20 ), which is the number of test cases. The test cases appear with no blank lines in between. The first line of each test case consists of the number of cities (between 1 and 50) followed by pairs of integers (x, y) which are location of cities (each pair in one line), followed by number of faces in a separate line (between 1 and 50), followed by face information on each line. Face information consists of number of cities making the face and the city numbers in clockwise (or counterclockwise) order.

    Output

    There should be a single line containing the boundary face number for each test case, with no blank lines in between.

    Sample Input

    1
    5
    2 6
    4 4
    4 7
    8 6
    4 10
    3
    4 1 2 4 3
    4 1 3 4 5
    4 1 2 4 5

    Sample Output

    3

    Source

    样例输入

    1
    5
    2 6
    4 4
    4 7
    8 6
    4 10
    3
    4 1 2 4 3
    4 1 3 4 5
    4 1 2 4 5

    样例输出

    3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部