HouseBuilding
TCO13 Round 1A · 2013-02-19 · by gojira_tc
Problem Statement
You are given a
Constraints
- area will contain between 1 and 50 elements, inclusive.
- Each element of area will be between 1 and 50 characters long, inclusive.
- All elements of area will be of the same length.
- Each element of area will contain digits ('0'-'9') only.
Statement by TopCoder, Inc. — view the original on the archive.
{"10",
"31"}
Returns: 2
The given area is not leveled, because the minimum height is 0 and the maximum height is 3. Manao needs to reduce the height of lower left square by 2.
{"54454",
"61551"}
Returns: 7
In the optimal solution each square will have height either 4 or 5. To reach such a configuration, Manao should reduce the height of one square from 6 to 5, and increase the heights of two other squares from 1 to 4.
{"989"}
Returns: 0
The area is already leveled.
{"90"}
Returns: 8
{"5781252",
"2471255",
"0000291",
"1212489"}
Returns: 53
Submissions are judged against all 127 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class HouseBuilding with a public method int getMinimum(vector<string> area) · 127 test cases · 2 s / 256 MB per case