M,x,y = map(int, input().split())
lis = list(map(int, input().split()))
low = []
up =[]
e = 0
coprange = x * y
for item in lis:
low.append(item - coprange)
up.append(item + coprange)
for i in range(len(low)):
if low[i] < 0:
low[i] = 1
for i in range(len(up)):
if up[i]>100:
up[i] = 100
low1 =sorted(low)
up1 =sorted(up)
for i in range(1,len(low)):
c = low1[i] - up1[i-1]
if c>0:
e += c
if up1[i]<100:
e += (100 - up1[-1])
print(e)
There are three extra print statements in your submitted code while there’s only one print Statement in this code, maybe check if that’s causing the problem.
for 21 : max reach is from 1 to 41
for 75 : max reach is from 55 to 95
so the nos which are left unreached are 41 to 55 i.e 14 and 95 to 100 i.e 5 and 14+5=19 != 18
bro just look at the problem in example same data set is used and there is also same answer 18
even explanation is given below how 18 will be output for that input
You’ve got a 100% reproducible testcase now; figure out the mistake that is causing your solution to give the wrong answer, and then work out how to correct it
Most of the people who post a doubt expect a magical wizard to pop up and correct their code, so that they can finally see that green tick over that problem. They don’t understand it’s more important to realize the mistake that they made. I like how you provide counter test cases and push people to correct their own code!