Editorial for TLE '16 Contest 4 P3 - Cubes
                Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
                Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
To solve this problem, it is necessary to choose all possible locations of the  corners. This can be done with a permutation.
To check if a position is valid, there should be  beams in the proper locations. Any remaining beams do not matter and can be thrown away.
Time complexity:  where 
 is the number of corners and 
 is the number of beams in the cubic frame.
One common mistake is just counting the number of beams that connect to a corner. For  tetrahedra, there are 
 corners and 
 beams, and each corner is connected to 
 beams. It is not possible to create a cube from 
 tetrahedra.
Comments