PivotOJ

Treasure Spotting

시간 제한: 1000ms메모리 제한: 512MB출처: ICPC Rocky Mountain Regional 2018BOJ 22284

문제

For Timmy's birthday his parents threw him a pirate themed party! A treasure is buried in the yard and now it is up to Timmy and his pirate crew to find it. Help the pirates find the treasure by letting them know who can see where the treasure is buried.

To make the game interesting, there are walls placed in the yard to obscure vision. Each pirate has a field of view that determines what they can see. Each pirate can see a certain distance away and can only see in a semi-circle based on the direction they are looking (see image below). A point cannot be seen in a pirate's field of view if either another pirate or some part of a wall is directly between the point that is being looked at and the pirate that is looking.  Each pirate is a single point, and each wall is an infinitely thin line.

Which pirates can see where the treasure is buried?

Figure F.1: The left picture illustrates Sample Input 1 where the right-most pirate is the only one who can see the location of the buried treasure. The right picture illustrates Sample Input 2 where the middle pirate is the only one who can see the buried treasure.

입력

The first line of input contains two integers WW (0W10000 \leq W \leq 1 \, 000), which is the number of walls and PP (1P10001 \leq P \leq 1 \, 000), which is the number of pirates.

The second line contains the coordinates of the treasure.

The next WW lines describe the walls. Each of these lines contains two coordinates (x,y)(x,y) and (x,y)(x',y') which are the two (distinct) endpoints of this wall.

The next PP lines describe the pirates. The iith of these lines contains two (distinct) coordinates (xi,yi)(x_i,y_i), which is the position of the iith pirate, and (xi,yi)(x_i',y_i'), which is the furthest point that this pirate can see in the direction they are looking. That is, the radius of the semi-circle for this pirate is the distance between (xi,yi)(x_i, y_i) and (xi,yi)(x_i',y_i').

All coordinates are an (x,y)(x,y) integer pair with x,y109|x|,|y| \leq 10^9. No two pirates will have the same coordinate position, the treasure will not share a coordinate position with any pirate and no part of any wall will touch a pirate or the treasure. Note that walls can overlap in any way with other walls.

출력

Display PP lines, one per pirate. The iith of these lines should display visible if the iith pirate can see where the treasure is buried and not visible otherwise.

예제

예제 1

입력
2 3
2 3
1 2 2 0
0 0 3 1
0 1 3 4
5 0 5 5
2 6 2 5
출력
not visible
visible
not visible

예제 2

입력
0 3
0 0
1 0 1 1
3 0 -4 0
-2 0 -5 0
출력
visible
not visible
not visible
코드를 제출하려면 로그인하세요.