BearFills
2015 TCO Parallel 3B · 2015-04-08 · by Errichto
Problem Statement
A set of stamps is called good if it can be used to cover the entire grid. Each stamp must be placed along the grid lines. I.e., for each stamp each cell is either completely covered by the stamp or not covered at all. The stamps may overlap arbitrarily. The stamps may also cover areas outside of the grid. For example, you may use a 4x4 stamp just to cover a single cell in the corner of the grid.
You are given the
Notes
- N will be between 1 and 60, inclusive.
- H and W will be between 1 and 10^18, inclusive.
Constraints
3 1 3 Returns: 5
He has a 1x3 rectangle and 3 square stamps. The stamps' sides are 1, 2, and 4. The good sets of stamps are the following ones: (1,2), (1,2,4), (1,4), (2,4), and (4).
3 3 5 Returns: 1
He has a 3x5 rectangle and 3 square stamps. The stamps' sides are 1, 2, and 4. He needs all of them.
60 3 2 Returns: 1152921504606846972
He has a 3x2 rectangle and 60 square stamps. Only four sets are not good: (), (1), (2), and (1,2). The answer is 2^60-4.
6 5 4 Returns: 56
1 1 1 Returns: 1
empty tests, could be changed into example
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 BearFills with a public method long long countSets(int N, long long W, long long H) · 93 test cases · 2 s / 256 MB per case