Logo
(追記) (追記ここまで)

28046번 - Gravitational Wave Detector 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB56352357.500%

문제

Byteland is a very inhospitable planet, so its inhabitants study the galaxy in search of a better planet to move to. In this world, astronomy is a matter of survival. The President of Byteland has just approved a proposal from the Science Minister to build a new Gravitational Wave Detector (GWD). Its design consists of three scientific stations to be built somewhere on the planet’s capital city (which you can treat as a two-dimensional plane). Their locations must be distinct and collinear, and one of the stations must be exactly in the middle of the other two.

This GWD will consume massive amounts of energy, so the Science Minister must choose the stations’ locations with this in mind. She studied the capital city’s electric grid, and learned the following:

  • The city has two major power plants. Each one has its own area of influence that can be seen as a non-empty convex polygon with no three consecutive vertices aligned. Within its area of influence, each major power plant can deliver as much power as the GWD requires.
  • Throughout the city, there are $N$ minor power plants, and each can deliver the required power only to their immediate vicinity.
  • The areas of influence of the two major power plants do not intersect anywhere, not even on the borders. No two minor power plants have the same location, but a minor power plant can be within the area of influence of a major power plant.

With this knowledge in mind, the Science Minister decided to adopt the following additional constraints on the locations of the GWD stations:

  • The first station will be built within the area of influence of the first major power plant.
  • The second station will be built within the area of influence of the second major power plant.
  • The third station will be built at the location of a minor power plant.

Any of the three GWD stations can be the middle one in the line. You can treat each GWD station and each minor power plant as a point with negligible size. The area of influence of each major power plant includes its border.

The next step for the Science Minister is to choose which minor power plant will house the third GWD station. Given the areas of influence of the two major power plants, and the locations of all minor power plants, you must find which ones are suitable candidates.

The figure above shows an example of an electric grid layout, as well as a few possible configurations for the GWD. It also shows two minor power plants that can’t possibly be used for the GWD.

입력

The first line contains an integer $M_1$ (3ドル ≤ M_1 ≤ 10^5$) indicating the number of vertices of the area of influence of the first major power plant. Each of the next $M_1$ lines contains two integers $X_1$ and $Y_1$ ($-10^8 ≤ X_1, Y_1 ≤ 10^8$), representing the coordinates of one of those vertices. Vertices are given in counterclockwise order.

The next line contains an integer $M_2$ (3ドル ≤ M_2 ≤ 10^5$) indicating the number of vertices of the area of influence of the second major power plant. Each of the next $M_2$ lines contains two integers $X_2$ and $Y_2$ ($-10^8 ≤ X_2, Y_2 ≤ 10^8$), representing the coordinates of one of those vertices. Vertices are given in counterclockwise order.

The next line contains an integer $N$ (1ドル ≤ N ≤ 5 \times 10^5$) indicating the number of minor power plants. Each of the next $N$ lines contains two integers $X$ and $Y$ ($-10^8 ≤ X, Y ≤ 10^8$), representing the coordinates of one of the minor power plants. Minor power plants are identified by distinct integers from 1ドル$ to $N,ドル according to the order they appear in the input.

출력

Output a single line with a string of length $N$ such that its $i$-th character is the uppercase letter “Y” if the minor power plant $i$ is a suitable candidate, and the uppercase letter “N” otherwise.

제한

예제 입력 1

3
2 5
4 5
2 7
3
8 8
10 6
10 8
10
5 7
5 8
6 6
7 7
9 4
13 9
15 8
15 10
15 12
18 9

예제 출력 1

YNYNNNYYNY

예제 입력 2

4
1 3
2 4
1 5
0 4
4
3 1
2 1
2 0
3 0
7
1 2
6 -5
2 2
-3 9
2 -3
-1 7
1 3

예제 출력 2

YNYNYYN

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2022 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /