Culinary expert is the pioneer of Chef’s Earth Defense Organization, and his crucial to counter outsiders which are undermining the earth. As per data accumulated by the association, there are N outsider spaceships (numbered 1 through N) intending to attack the earth. The I-th spaceship will show up on the radar at time Ci. Every spaceship needs D time to arrive at earth once it shows up on the radar. 
Cook’s association claims an enormous laser gun which can demolish one spaceship in one shot. In any case, when the gun is utilized once it needs some measure of chill off time so as to be utilized once more (first shot doesn’t need chill off time before it is utilized). This chill off time, notwithstanding, is configurable. It must be set before the primary shot, and can’t be changed after that. In the event that Chef sets a let chill off time, that would build the vitality devoured by the gun, and the other way around – the higher the chill off time, the lower the vitality expended. 
This may be a long fight, and Chef needs to use as meager vitality as could reasonably be expected. So Chef needs to boost the chill off time while as yet having the option to annihilate all spaceships before any of them show up on earth. Specifically, the I-th spaceship ought to be shot between the occasions Ci and Ci+D (both end focuses comprehensive). 
The primary line of information contains a solitary whole number T indicating the quantity of experiments. The portrayal of T experiments follows. 
The primary line of each experiment contains two numbers N and D. 
The subsequent line contains N space-isolated numbers C1,C2,… ,CN. 
For each experiment, print a solitary line containing one genuine number― the greatest chill off time conceivable. Your answer will be viewed as right if the outright or relative blunder of the appropriate response doesn’t surpass 10−6. 
1≤Ci≤109 for each legitimate I 
The total of N over all experiments doesn’t surpass 106 
Subtask #1 (50 focuses): 
the total of N over all experiments doesn’t surpass 10,000 
Subtask #2 (50 focuses): Original limitations 
Test Input: 
3 2 
3 2 3 
2 1 
5 6 
Test Output: 

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

fourteen − 11 =