In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Byteasar, who is interested in wildlife photography, is planning a trip to Australia. He has started preparing his photographic equipment for taking pictures of kangaroos, and has to decide what items to pack. His equipment includes an extensive collection of photographic lenses with varying characteristics for different angles of view and focusing abilities. The best quality of pictures of animals, such as kangaroos, is achieved when the distance between the camera and the animal is within the optimal range of the lens.
Byteasar's trip passes through a sequence of access points for wildlife observation and photography. The Australian guides gave Byteasar a detailed description of these observation points-in particular, the distances at which kangaroos can be expected.
Obviously, not all the lenses from Byteasar's large collection will fit in his luggage, so some decisions must be made. Since Byteasar wishes to keep his lens-changes to a minimum, he wants to find-for each of the lenses-the longest contiguous sequence of observation points on the trip for which that lens is suitable. A lens is suitable for a given observation point if there exists a distance from the range of expected distances that lies within the optimal range of that lens.
The first line of the standard input contains two integers, and (, ), where is the number of observation points on the trip and is the number of lenses in Byteasar's collection.
The next lines describe the access points for wildlife observation and photography on Byteasar's trip. Each of these lines contains two integers, and (), indicating that at the -th observation point kangaroos can appear at a distance of to bytean feet, inclusive.
The next lines describe the lenses. Each of these lines contains two integers, and (), indicating that the -th lens works best for kangaroos that are at a distance from to bytean feet from the camera, inclusive.
The standard output should consist of lines containing exactly one integer each. The -th output line indicates the number of observation points in the longest contiguous segment of the trip where the -th lens can be used by Byteasar. The lenses are numbered according to their order in the input file.
For the input data:
3 3 2 5 1 3 6 6 3 5 1 10 7 9
the correct result is:
2 3 0
Task authors: Jakub Lacki, Jakub Radoszewski.