The gravitational force on each of the cubes is the same, so they experience the same downward acceleration. So since they started from the same height with zero vertical velocity, they reach the floor at the same time, even though one has traveled some distance horizontally in the meantime.
This is an example of the independence or separability of the components of motion. We can define the axes along which we measure, and treat vectors as the sum of their components along those axes.