Computer Science, asked by vartikasaxena251, 1 month ago

NUNUTTUM.CUMTUMESt/gla-summer-training-test-1/challenges/stop-the-spread-1
Problem
Submissions
Leaderboard
Discussions
f
Conte
Submi:
N people are standing in a line. For simplicity, we'll view them as points on a line such that i th person is
standing at Xi
. Exactly one of them is infected with the virus. The virus can effect non-infected persion if
distance between an infected and non-infected person is less than or equal to d. The task is to determine the
smallest and largest value of infected person after the virus is spread completely, given that none of the
person leave the spot they were standing at.
For example if n = 5 and d = 2 and people are standing at 2, 5, 7, 8, 11, the minimum number of infected
people would be 1 (either person at 2 or 11) and maximum number of infected persons would be 3. (either
one of person standing at 5, 7, 8 could be infected)
Max Sc
Difficult
Rate Thi
More
Input Format
The first line contains a number t denoting the number of test cases.
The first line of each test case contains two number N and d separated by space.
The next line contains N space separated integers
Constraints
1 <=t<= 2000
1 <= N <= 100
1 <= X; <= 1000, for all i
Output Format
e senarated numbers the minimum and maximum
Eor each test case nrint the cinale line containing two s
anything
O
101​

Answers

Answered by farhantanzeem786
0

Answer:

solve it yourself because it's your question

Similar questions