Tasks:
 
Task DescriptionDiscussion (0)
Task :: explosion
There are N figures on the x-axis. These figures are special because any of them can explode and make all figures in the radius of that explosion to explode. You can shoot just one figure, and you want to make as big a damage as possible (you want to destroy as many as possible figures). Your task is to find which figure is the best to shoot. There are no 2 figures with same position.

INPUT:
From the first line read number N, representing number of figures on x-axis (1<=N<=10^5). The second line contains N numbers representing positions of figures on x-axis (-10^9<=position[i]<=10^9). Third line will contain N numbers representing radiuses of explosions of respective figures (0<=radius[i]<= 10^9).

OUTPUT:
You should write which figure is the best to shoot and how many figures would be destroyed. If there are more figures that give maximal solution, write the first one that appears in input data.


Input:
5
0 4 6 9 13
3 4 2 0 7

Output:
5 5

Explation: if you shoot 1st figure then just 1st figure will be destroyed
if you shoot 2nd figure then figures 1,2,3 will be destroyed
if you shoot 3rd figure then figures 1,2,3 will be destroyed
if you shoot 4th figure then just 4th figure will be destroyed
if you shoot 5th figure then all figures will be destroyed
so you should shoot 5th figure and you will destroy 5 figures
Submit Solution
:
:
Available Languages
Task info
Name:explosion
Time:0.75 sec.
Memory:16 MB
#Tests:10
AddedBy: demjan0001
Source:demjan0001
Task Ratings
Difficulty:

4.9 (20 votes)
Quality:

4.9 (18 votes)
Acceptance Rate
Recent Submissions
Fastest Solutions
UserTime
a180285 0.414 s.
ardiankp 0.417 s.
halil 0.433 s.
tamaki 0.543 s.
simpleton 0.564 s.
etaehyun4 0.619 s.
vjudge2 0.665 s.
liszt1990 0.675 s.
robodobo 0.71 s.
vontake1221 0.724 s.
Solved By