Hi there, I just joined and started with some problems. This SEUG one is where I am stuck. Result says wrong answer. Can somebody help me with this. Thanks.
t = int(input()) #test cases
for i in range(t):
l,b,h,w = map(int, input().split())
n = int(input())# no of stones
l = list(map(int, input().split()))
space_left = h - w + 1 #to spill over 1 more is needed
l.sort(reverse=True)
temp = l[0]
count = 1
for i in range(1,n):
if l[i]+temp >= space_left:
count+=1
break
else:
temp = l[i] + temp
count+=1
print(count)