Introduction - If you have any usage issues, please Google them yourself
This question the sort and details of the deal, it is selected int array as a data structure.
Algorithm for the following ideas: For the input data, according to the subsequent + - , with a, b, respectively, the array of infected and normal animal height. Then a, b, respectively, the two array sort. For the subsequent group m queries, respectively, to determine the number of animals to kill x and the number of animals manslaughter y, were asked a, b array of reciprocal x, y position of the element, a little processing, respectively, as the maximum height and The minimum height output (if not and logic, outputs-1). The program ends.
Complexity: The computation time of this problem is mainly used for sorting (fast row), so the complexity is O (nlogn). The spatial complexity is O (n).