I have a BOW and ARROW

All submissions for this problem are available.
**Hawkeye**: *"Look, the city is flying. We are fighting an army of robots, and **I have a bow and arrow. None of this makes sense.** But, I'm going back out there because it's my job. Okay? And I can't do my job and babysit. It doesn't matter what you did or what you were. If you go out there, you fight, and you fight to kill. Stay in here, you're good. I'll send your brother to come find you. But **if you step out that door, you're an AVENGER**"* **Hawkeye (aka Ronin)** has his bow and arrow on the ground and a number of targets in the sky and he can shoot the arrow in any direction from any where on the ground. This battlefield is set in an infinite 2D world in both positive and negative x direction. The bow can be moved anywhere on the line y=0 and also it can be rotated to shoot in any direction. The target is destroyed if the arrow touches or hits the target anywhere. The targets are all in the form of straight line segment of some length parallel to the x axis placed somewhere above (y > 0). Now, Hawkeye has reached almost at the end of the battle and last $N$ targets are still available to be shot and only one arrow is left with him. Also this time he has got a power up that this time the arrow will not stop after hitting one target but it will keep moving forward and destroying other target in the straight line in which it has been shot. The amount of power that Hawkeye receives for destroying a target of length $L$ is $L$. As only one chance is remaining, he wants to acquire as much power as possible . Now, he gives you the left coordinate of the $N$ remaining targets and their respective length and your task is to **tell him how much maximum power he can acquire in one last shot. You also have to output the number of targets destroyed in acquiring the maximum power. If there are more than one way of getting maximum power who have to print the minimum number of targets destroyed.** ###Input:  First line will contain $T$, number of test cases. Then the test cases follow.  First line of each test case contains an integer $N$, the number of target left.  Next $N$ lines contain 3 integers each, $X$, $Y$ and $L$, the left most coordinate of the target and the length of the target. ###Output: For each test case you have to output 2 integers separated by space. The First integer denoting the maximum points that can be acquired and second the number of targets destroyed. ###Constraint:  $1 \leq T \leq 10$  $1 \leq N \leq 2000$  $0 \leq X \leq 1000000$  $1 \leq Y \leq 1000000$  $1 \leq L \leq 1000$  Sum of N over all the test cases does not exceed 2000. ###Sample Input: 1 7 1 1 10 15 1 10 3 2 10 30 2 10 4 5 10 6 7 10 30 7 20 ###Sample Output: 40 3 ###Sample Explanation: There is a way to shoot the gun in such a way that it hits target number 2, 4 and 7, amounting to total points of 40 by hitting minimum of 3 targets. In the below image the red lines show the targets and the black line shows one of the optimal way of shooting the arrow. ![Sample] (https://codechef_shared.s3.amazonaws.com/download/HYC/External_contest_i...)Author:  shauryakr 
Editorial  https://discuss.codechef.com/problems/CR192 
Tags  cord2019, linesweep, medium, shauryakr 
Date Added:  21022019 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions