Cube Net
Time limit1sMemory limit128 MB
Given a hexomino net on a 6x6 grid with faces numbered 1 to 6, determine if it folds into a valid cube and if so output the face opposite face 1, otherwise output 0.
- Level
Medium7 of 10
- Topics
- Simulation, Geometry, Implementation
- Solved
- No attempts yet
Problem
Consider whether the dotted edges of a given net can be folded to form a die-shaped cube. Each face of the net is marked with a distinct integer from 1 to 6.
Net (1) can be folded into a cube, but net (2) cannot. Write a program that determines whether the input net can be folded into a cube.
Input
The input consists of 6 lines. Each line contains 6 integers from 0 to 6, separated by single spaces. The numbers 1 through 6 represent the six faces of the net, and 0 represents an empty cell outside the net.
Output
If the input net can be folded into a cube, print the number written on the face opposite the face marked 1. If it cannot be folded into a cube, print 0.

