Connection Status:
Competition Arena > Hyperbox
TCO19 SRM 751 · 2019-01-09 · by misof · Brute Force, Math, Simple Search, Iteration
Class Name: Hyperbox
Return Type: int
Method Name: count
Arg Types: (int)
Problem Statement

Problem Statement

  • The boundary of a two-dimensional rectangle is one-dimensional (a collection of line segments), and we can measure its length.
  • The boundary of a three-dimensional box is two-dimensional (a collection of rectangles), and we can measure its area.
  • In the same sense, the boundary of a four-dimensional hyperbox is three-dimensional, and we can measure its volume.

You are given the int volume (in cubic meters). Return the number of distinct hyperboxes with positive integer sides (in meters) and this exact surface volume.

Two hyperboxes are distinct if they are not congruent. (In other words, they are distinct if we cannot rearrange the dimensions of one to get the dimensions of the other.)

Constraints

  • volume will be between 1 and 200,000,000, inclusive.
Examples
0)
8
Returns: 1

The smallest possible hyperbox (i.e., the 1 x 1 x 1 x 1 hyperbox) is the only one with surface volume 8.

1)
1234567
Returns: 0

There are no hyperboxes with integer sides and this exact surface volume.

2)
120
Returns: 3

One of the three distinct hyperboxes with this surface volume has side lengths 1, 2, 2, and 7.

3)
1
Returns: 0
4)
2
Returns: 0

Submissions are judged against all 109 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class Hyperbox with a public method int count(int volume) · 109 test cases · 2 s / 256 MB per case

Submitting as anonymous