#P1012. Problem 2. Grass Segments
Problem 2. Grass Segments
当前没有测试数据。
USACO 2024 US Open Contest, Gold Problem 2: Grass Segments
I. Problem Description
1. Grass Planting Situation
Bessie is planting some grass on the positive real line. She has () different cultivars of grass, and will plant the th cultivar on the interval ().
2. Growth Condition
In addition, cultivar grows better when there is some cultivar () such that cultivar and cultivar overlap with length at least ().
3. Task
Bessie wants to evaluate all of her cultivars. For each , compute the number of such that and overlap with length at least .
II. Input Format
- The first line contains .
- The next lines each contain three space-separated integers , , and .
III. Output Format
The answers for all cultivars on separate lines.
IV. Sample Input and Output
Sample 1
- Input
2
3 6 3
4 7 2
- Output
0
1
- Explanation The overlaps of the cultivars is , which has length , which is at least but not at least .
Sample 2
- Input
4
3 6 1
2 5 1
4 10 1
1 4 1
- Output
3
3
2
2
Sample 3
- Input
5
8 10 2
4 9 2
3 7 4
5 7 1
2 7 1
- Output
0
3
1
3
3
V. Scoring Rules
- Input 4 - 5: .
- Inputs 6 - 11: is the same for all intervals.
- Inputs 12 - 20: No additional constraints.
- In addition, for Inputs 5, 7, , 19, for all .
VI. Problem Source
Problem credits: Benjamin Qi.