I am working on the problem “Paying Up”. Despite some time spent trying to solve this issue myself I have yet to find the source of this NZEC error.
Here is the code:
It yields the correct answers when I run it. The break statements just make it run a little faster,
the code outputs the correct solution without them as well. Hopefully someone will be able to help me out.
Thanks in advance!
import itertools cases = int(raw_input()) for i in range(cases): found = False inputList =  notes,request = map(int,raw_input().split()) for j in range(notes): inputList.append(int(raw_input())) for k in range(1,len(inputList)+1): subsets = list(itertools.combinations(inputList,k)) for subset in subsets: sumOfSet = sum(subset) if(sumOfSet == request): found = True break if(found == True): break if(found == False): print "No" else: print "Yes"