#P9426. [蓝桥杯 2023 国 B] 抓娃娃
[蓝桥杯 2023 国 B] 抓娃娃
Problem Description
Xiaoming took line segments to practice playing a claw machine. He laid all the segments on the number line. For the -th segment, its left endpoint is at and its right endpoint is at . Xiaoming uses intervals to “frame” these segments. The range of the -th interval is . If at least half of a segment’s length is contained in some interval, then the segment is considered to be framed by that interval. Please compute how many segments are framed by each interval.
Input Format
The input has a total of lines.
The first line contains two positive integers .
The next lines each contain two integers .
The next lines each contain two integers .
Output Format
Output a total of lines, each containing one integer.
3 2
1 2
1 3
3 4
1 4
2 4
3
2
Hint
Test Case Scale and Conventions
- For of the testdata, is guaranteed.
- For of the testdata, is guaranteed, , , and .
Problem H of Group B (C/C++), College Division, Finals of the 14th Lanqiao Cup Software Contest.
Translated by ChatGPT 5