문제
Farmer John needs your help deciding where to build a fence in the shape of a straight line to help restrict the movement of his cows. He has considered several possible fence locations and needs your help to determine which of these are usable, where a fence is considered usable if all of the cows are on the same side of the fence. A fence is not usable if there is a cow that lies directly on it. FJ will be asking you a number of queries regarding possible fence locations; a query should be answered "YES" if it corresponds to a usable fence location, "NO" otherwise.
Additionally, FJ may occasionally bring new cows into the herd. When a new cow joins the herd, all fence queries from that point onward will require her to be on the same side of a fence as the rest of the herd for the fence to be usable.
[Problem credits: Richard Peng, 2015]
입력
The first line of input contains N
The following N lines describe the initial state of the herd. Each line will contain two space separated integers x and y giving the position of a cow.
The remaining Q lines contain queries either adding a new cow to the herd or testing a fence for usability. A line of the form "
All cow positions will be unique over the whole data set and will satisfy
출력
For each fence query, output "YES" if the fence is usable. Otherwise output "NO".
예제1
3 4
0 0
0 1
1 0
2 2 2 3
1 1 1
2 2 2 3
2 0 1 1
YES
NO
NO
The line
Warning: The I/O for this problem is fairly large. C++ users may consider using scanf or the line "ios_base::sync_with_stdio(false)" to read input faster. Java users should avoid using java.util.Scanner. Do not flush output (e.g. using std::endl) after each query.