I wrote a code for february lunchtime 2021, question SEDMAX.
I’m getting correct answers for the input examples but when i submit i get wrong answers and tle. Can someone please check the code…
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int, input().split()))
lst = []
A.sort(reverse = True)
for i in range(N):
for j in range(i+1,N):
c = A[i]-A[j]
lst.append(c)
cost = set(lst)
size = len(cost)
print(size)