Mock CCC '26 S1 - A Cube Problem

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 512M

Author:
Problem type
Mock Canadian Computing Competition: 2026 Senior #1

Jeremy loves his cubes. He has an unlimited supply of unit cubes, and as a hobby, he creates larger cubes by connecting the unit cubes. Specifically, he's created a cube with side length N, that is to say, each edge has the same length as N small cubes. Now, this newly created cube looks extremely boring. Jeremy decides to paint the exterior of the cube. Seeing his new creation, Jeremy is happy with the cube, so he removes the cubes with paint on them to create a smaller, unpainted cube. He then repeats this process until every block in the cube has paint on at least one of its sides.

After putting his painted cubes in a bin, Jeremy runs into an issue: he doesn't know how many cubes have 1, 2, 3, 4, 5 and 6 painted faces. As his good friend, you have graciously offered to help Jeremy count the cubes for him!

Below is a diagram representing the outer faces painted on a cube where N = 3. In this diagram, the blue, white and red represent the cubes with 1, 2, and 3 painted faces, respectively. Note that in this step, there are no faces with 4, 5 or 6 faces painted.

Once this step is complete, we have only 1 cube remaining, which we paint all 6 sides of.

Input Specification

The first and only line of input contains an integer 1 \le N \le 10^3.

The following table shows the point distribution for this problem.

Marks Bounds on N Additional Constraints
5 marks 1 \le N \le 100 None
5 marks 1 \le N \le 1000 N is guaranteed to be odd
5 marks 1 \le N \le 1000 N is guaranteed to be even

Output Specification

In one line, output the number of cubes with 1, 2, 3, 4, 5 and 6 faces painted, respectively.

Sample Input

3

Output for Sample Input

6 12 8 0 0 1

Explanation of Output for Sample Input

If we look at our diagram, there are 6 total cubes with 1 face painted (the center of each face), 12 with 2 faces painted (1 on each edge), 8 with 3 faces painted (The 8 corners), and 1 with 6 faces painted (the core).


Comments

There are no comments at the moment.