GoodSubset
SRM 632 - TCO14 Wildcard Sweep · 2014-08-25 · by dreamoon
Problem Statement
You have some cards, each containing a positive integer.
You are given a
You are also given an
Let X be the number of subsets with the above property. Compute and return the value (X modulo 1,000,000,007).
Constraints
- goodValue will be between 1 and 2,000,000,000, inclusive.
- d will contain between 1 and 100 elements, inclusive.
- Each element of d will be between 1 and 2,000,000,000, inclusive.
10
{2,3,4,5}
Returns: 1
There is only one good subset:{2,5}.
6
{2,3,4,5,6}
Returns: 2
There are two good subsets: {2,3} and {6}.
1
{1,1,1}
Returns: 7
All non-empty subsets of this set of cards are good.
12
{1,2,3,4,5,6,7,8,9,10,11,12}
Returns: 6
5
{1,2,3,4}
Returns: 0
Submissions are judged against all 93 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class GoodSubset with a public method int numberOfSubsets(int goodValue, vector<int> d) · 93 test cases · 2 s / 256 MB per case