| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 56 | 35 | 23 | 57.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:
With this knowledge in mind, the Science Minister decided to adopt the following additional constraints on the locations of the GWD stations:
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.
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
YNYNNNYYNY
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
YNYNYYN