0-1 bag problem, with little space