Partially correct answer (ZCO15002)

Please help my solution for problem https://www.codechef.com/ZCOPRAC/problems/ZCO15002 is giving partially correct answer on submission. Please help.
My code:

from itertools import combinations
def sub(q):
    return list(combinations(q,2))
n,k=tuple(int(i) for i in input().split(" "))
l=[int(i) for i in input().split(" ")]
s=sub(l)
c=0
for i in s:
    if abs(i[0]-i[1])>=k:
        c+=1
print (c)

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Link to my solution
https://www.codechef.com/viewsolution/29844078
and it seems I’m getting TLE time limit issue

thanks for your response @ssjgz

1 Like