CodeChef April’21 Long Challenge Solution (Div 3) — Chef and Dice

Hydroid
1 min readApr 7, 2021

Problem Statement:

Chef has N 6-sided standard dice. Each die has dimensions 1×1×1. Since Chef is bored during the quarantine, he decides to stack dice for fun.

First, Chef forms four vertical stacks of dice (not necessarily with the same height; empty stacks are allowed) on his table, which together make up a pile of dice with base area up to 2×2. Among all such structures, the total visible surface area of Chef’s structure must be the smallest possible.

Then, Chef calculates the number of pips on the visible faces of all dice in the structure. A face of a die is visible if it does not touch the table or another die.

Now, he is wondering: among all possible arrangements of dice, what is the maximum possible total number of visible pips? Since he is busy cooking, he is asking you to solve this.

Link: Chef and Dice

Solution:

--

--

Hydroid

Currently working as a Full Stack Developer in India