21990_Mushroom-pickingsites

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

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

Pro.ID

21990

Title

Mushroom-picking sites

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Mr. X knows the forest like the back of his hand and never returns emptyhanded when he goes out to pick mushrooms. This year, however, he was in for a surprise: part of the forest was fenced off and there was some sort of construction going on behind it...

    Mr. X has provided you with a map of the forest with the fence around the construction site marked. Looking at the map, you can see that the fence is a polygon that does not intersect with itself. He, however, does not want to disclose the locations of the mushroom-picking sites... Therefore you have agreed that he will go to the forest and from time to time call you using his cell phone to ask if he can visit one or another place in the forest.

    Write a program to answer his queries.

    输入

    The first line contains N (3 ≤ N ≤ 100,000), the number of vertices of the polygon, and M (0 ≤ M ≤ 100,000), the number of queries. Each of the following N lines contains two integers in the range -100,000…100,000, the coordinates of the vertices of the polygon in the order in which they appear on the perimeter. It is known that the only common point between any two edges is the common endpoint they share if they are incident. Each of the following M lines also contains two integers in the range -100,000…100,000, the coordinates of the points Mr. X queries you about.

    输出

    Description

    Mr. X knows the forest like the back of his hand and never returns emptyhanded when he goes out to pick mushrooms. This year, however, he was in for a surprise: part of the forest was fenced off and there was some sort of construction going on behind it...

    Mr. X has provided you with a map of the forest with the fence around the construction site marked. Looking at the map, you can see that the fence is a polygon that does not intersect with itself. He, however, does not want to disclose the locations of the mushroom-picking sites... Therefore you have agreed that he will go to the forest and from time to time call you using his cell phone to ask if he can visit one or another place in the forest.

    Write a program to answer his queries.

    Input

    The first line contains N (3 ≤ N ≤ 100,000), the number of vertices of the polygon, and M (0 ≤ M ≤ 100,000), the number of queries. Each of the following N lines contains two integers in the range -100,000…100,000, the coordinates of the vertices of the polygon in the order in which they appear on the perimeter. It is known that the only common point between any two edges is the common endpoint they share if they are incident. Each of the following M lines also contains two integers in the range -100,000…100,000, the coordinates of the points Mr. X queries you about.

    Output

    The output should consist of exactly M lines, one for each query. The line should contain the word Inside if the point queried about is inside the polygon, the word Outside if the point is outside the polygon, and the word Border if the point lies on an edge of the polygon.

    Sample Input

    4 4
    1 2
    3 -2
    0 -1
    -3 -2
    2 0
    1 -1
    -2 1
    1 2

    Sample Output

    Border
    Inside
    Outside
    Border

    Source

    样例输入

    4 4
    1 2
    3 -2
    0 -1
    -3 -2
    2 0
    1 -1
    -2 1
    1 2

    样例输出

    Border
    Inside
    Outside
    Border

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部