Congratulations on becoming the new boss of "Horizontal Company, branch: Sylhet"! But now you have a hard task in front of you, The central branch has sent you a list of prospective employees to put in your office. However, just like it's name, the company's office is a long horizontal continuous segment . Each employee has a specific coordinate where he will work, along with a radius of workspace. i.e. any point distance from X is used by that employee for work (points at exactly R distance are not used). Formally speaking, consider any coordinate (not necessarily integer), if then this point is used by the employee. Being an efficient boss, you want to select the maximum number of employees such that their workspaces don't intersect.
But there's another problem! This branch is relatively new, so the whole office is not really open yet. The central office will give you a segment to work with. The workspaces of the selected employees should be strictly inside the given segment. The central office has sent you emails each containing a segment . You need to tell them what is the maximum number of employees you can select for each such segment. Note that each segment is independent from other emailed segments.
First line will contain number of test cases, (). Each test case will be an independent office (and staff). Each test case will begin with a line containing () and (). Next lines will contain two numbers, () and (), the employee's working coordinate and radius of work. Next line will contain (). Next lines will contain and ().
For each test case, first output "Case #:" in a single line. Then for each of the emailed segments in that case, output a line containing the maximum number of employees you can select for that segment.
Input | Output |
---|---|
2 20 3 5 5 15 5 10 10 1 0 20 20 3 5 5 15 5 10 5 2 3 17 10 15 | Case 1: 2 Case 2: 1 0 |
In the first case, employee no 1 and 2 can be selected who cover the intervals and . In the second case, for first email, employee no 3 can be selected who covers interval. For second email no employee can be chosen, as their intervals , and do not fit inside . |