Introduction - If you have any usage issues, please Google them yourself
Graphics
This topic on the sort and binary search, and data size up to 10 ^ 8, so the choice of long -type array as a data structure.
The idea of the algorithm is as follows: For the input x, y array, the first sort in order to form a line segment, and then, for each set of queries, binary search, the search process is as follows: The outer product of the vector, if the outer product is greater than 0 that the point above the line, is equal to 0 that the point in the line, otherwise the point below the line (of course while the query point to the mid+ Of the outer product to determine the exact location of the point). This binary search can find the location of the point. Finally, the output.
Complexity: Because this problem is mainly used in the binary search to determine, so the complexity of O (mlogn). The spatial complexity is O (n).