SP28600 BDOI16D - One Punch Man
Description
One Punch Man
=============
Saitama is the most powerful hero alive. Having apparently trained himself to superhuman conditions, Saitama faces a self-imposed existential crisis, as he is now too powerful to gain any thrill from his heroic deeds. Every monster he faces, is killed with only one of his punch.
There are _**N**_ groups of monsters on a line , _i_th of them is positioned at distance _**X**_ $ _{i} $ from the beginning of that line and has _**V**_ $ _{i} $ members. When Saitama punches the ground at _**P**_, all monsters within _**R**_ vicinity of that punch ( meaning from _**P-R**_ to _**P+R**_ both inclusive ) are killed by the shockwave . Saitama is tired after all his hero duties. So he will punch atmost _**K**_ times. Can you help him figure out , what is the maximum number of monsters he can kill.
**Input:**
The first line contains number of test case _**T**_. Then _**T**_ testcases follow. First line of each test case contains three integers _**N**_,_**R and k**_. Following _**N**_ lines contains two space separated intergers _**X**_ $ _{i} $ and _**V**_ $ _{i} $ .
**Limits:**
_T_ 1 _N_ $ ^{5} $
1 _V_ $ _{i} $ $ ^{4} $
1 _K_
For **Easy** Version:
0 _R,X_ $ _{i} $ $ ^{4} $
For **Hard** Version:
0 _R,X_ $ _{i} $ $ ^{8} $
**Output:**
For each test case, print a line "Case t: m" where t is the test case number and m is the the maximum number of monsters Saitama can kill.
Input
Output
2
4 3 1
6 10
12 110
19 100
24 30
5 3 2
3 3
5 2
3 8
10 5
0 5
Case 1: 130
Case 2: 23
**Explanation of sample input:**
In sample 1, Saitama can punch at position 21 or 22 to kill 130 monsters. If he punches at position 21 then the shockwave ranges from 18 to 24, killing monsters at 19 and 24. Similarly if he punches at 22 then then shockwave will kill from 19 to 25. Punch at no other position will kill more monsters.
In Sample 2 , Saitama can kill all monsters with 2 punches.
**Problem Setter: Moinul Shaon**
Input Format
N/A
Output Format
N/A