# [Community Puzzle] Kids blocks

https://www.codingame.com/training/medium/kids-blocks

Created by @MNada,validated by @Konstant,@Smelty and @Tony380.
If you have any issues, feel free to ping them.

Are the followings valid solutions?

0 6 1

5 1 6

No it’s not valid, keep them horizontal.

Think LEGO : you need to clip the studs.

Thanks for the reply. I read the statement a few more times but cannot find any specification about “horizontal only” or “Lego bricks which have studs”.

I know that it’s not said clearly in the statement but I assumed that the " chars were studs in the ascii representation and it was indeed that, I only considered horizontal blocks and my solution finds exactly the expected output.

I implemented extra rules for the vertical placement of blocks. As I am prioritizing horizontal placements, all test cases except the two were just fine to pass.

Had I known the “horizontal only” requirement I should have finished it with half the effort.

A bit of ascii drawing is far from clear enough. The author should make a remedy to the statement to make it more accurate to reflect the intent of the puzzle.

The validation tests are softer then test cases.
The stupid check (if the total area is a not prime numbers) works perfectly to pass validation.

I must be missing the obvious “trick” about this puzzle but I’m struggling to see what condition I should be checking for test case 6 to display “NOT POSSIBLE” instead of “POSSIBLE”.

My approach is to check the divisors of the total area of all pieces combined and if there are no two numbers that multiplied together give the total area it means that it’s not possible to build a rectangle/square.

Obviously this is not the case for test case 6 since my simple criterion doesn’t realise that you don’t have enough pieces, however, I’m struggling to see what check I should be implementing (of course this should also apply to any test condition).

Any help is much appreciated, thanks.