SUBTASK 1: In this subtask y = 0, so we can take every blue card for free. We look at every possible subset of red cards and compute the strength of the deck, keeping the value of the current maximal strength. time complexity: O(2^n n m)
SUBTASK 2: For every subset of red cards, we look at every possible subset of blue cards and compute the strength of the deck, keeping the value of the current maximal strength. time complexity: O(2^n 2^m)
SUBTASK 3: We look at every possible subset of red cards. For every blue card, we compute the strength change it'll bring if we add it to the deck. If a certain blue card has a positive strength change we can freely add it to deck time complexity O(2^n n m)