Something unexpected happened with this submission. Let's see if Genie can help.
Day 3 : The Spices Box
hardBacktracking with pruning
Imagine you are a merchant having n spice boxes. The weight ith spice box is wi. You can sell only spice sets having total weight 250g. So you need to make 3 groups of spice boxes such that each group has total weight 250g and no spice box is left ungrouped.
You need to determine whether it's possible or not. If possible you need to output the groups.
Input Format:
The first line of input contains n the number of spice boxes.
The second line contains n integers w1w2w3 .... wn, denoting the weights of the spice boxes.
Output Format:
You need to output "YES" or "NO" (without quotes and capitalized) denoting whether it's possible or not to make such groups.
If Yes then you need to output the groups in three lines, each line should contain the weights of the spice box present in the group.