p500 Zoo
The problem is easier after reading the examples. There is a feasible solution iff we have
2's followed by 1's followed by 0's. Some parts might be missing. Assuming it is k 2's and some nonzero 1's, then it is 2^(k+1).
p1000 FiveHundredEleven
A naive solution is to use
The first observation is that cards that are masked by bitset are equivalent, so we only need the count of them. Play any one of them is the same as play another.
The second observation is that there is no need to keep track of subsets already used. The reason is that for cards not masked, they must not have been used. So we can find them using bitset. For cards that are masked, we only care about their numbers. So remember the number of cards already used suffices.
No comments:
Post a Comment