Oh and there is a third restriction:

- all tuples for which B >= X should be part of the subset

Reply to this note

Please Login to reply.

Discussion

The answer by the way was very simple: sort by descending density and loop over each item. Try to add id to the subset and if the average amount of B remains above X keep it added. If it isn’t, skip it and try with the next item until you went through all of them