[Community puzzle] The max surface box

This topic is about the puzzle The max surface box.

Feel free to send your feedback or ask some help here!

1 Like

Hello,

My code passes all test cases, but when i submit, tests 4 and 5 do not.
Anybody have an advice about these cases ?

Thanks

2 Likes

Might sound as obvious but did you ensure you’re solution is fast enough ? Last 2 cases are big numbers and depending of you’re algorithm it can fail for delay reasons…

It feels like the specifications of the problem are innacurate (about what kind of plain solid is expected) or some of the solutions are wrong.

For instance with the test with 9 blocks, the minimal surface possible is 28 (a cube of size 22 (8 blocks) with an extra block on one side).
However, the expected answer is 30, a L shaped solid of size 2
2*3.

Is the first solution I give not considered a plain solid because one of the surfaces isn’t flat ?
If so, the problem would gain if it was made explicit, with proper examples.

Thanks for your possible answers! =)

1 Like

The shape is a full rectangular box.

I tried with the biggest number possible (1.500.000) and it worked very quickly. So i think it’s not a performance issue.
Maybe the creator could give a clue for these validation test cases (4 and 5)

1 Like

A real rectangle box isn’t always achievable.
What would it be for the case of size 9 (same for size 3, 5, 7 etc) ?

A real rectangle box is always achievable.
In worst case it would be 1 * 1 * N (prime numbers)
9 is 1 * 3 * 3

Of course 11N is always possible (but calling it rectangle is kind of borderline).
Thanks for the alternative for the 9 case, somehow I missed it as a possible solution (must have made a calculation mistake). I see where it goes.
Being more specific in the problem specification would really be a plus, for the others that might do this challenge in the future.

Bonjour, I have the opposite problem : my code don’t pass the 4th test but all the others. And when i submit i have 100% . désolé pour mon anglais.

Hello,

I have the same issue, all the tests is OK but when i submit, i can’t pass test 4 and 5. No problem for the test 6. Someone for a clue ?
Thank

Regards,

Wis

Hello,

Same problem for me too, can 100% the test cases but fail validator 4 and 5 :frowning: . A tip would be nice

-Kyto

1 Like

Hello!

Also the same issue with my code. Passes everything but validators 4 and 5. Appreciate any help :slight_smile:

Thanks

1 Like

Joining the party. Also got all working but 4 and 5, and unsure as to why.
Would appreciate if we knew if the code failed from running out of time or wrong output.

EDIT: I think I know what’s wrong, I suspect all of ours mistake is that a greedy algorithm for selecting lengths works for all the given test cases, but there are situations when the purely greedy method wouldn’t work, which are (I assume case 4 & 5).

EDIT2: can confirm (worked after I changed from a greedy algorithm to a greedy/brute force check mix.

1 Like

Ahhhh. It really wasn’t clear that the box had to be a complete block of xyz, with no extra 1x1x1 blocks stuck on. Now it makes more sense.

If it helps please like
Try this test-cases:
28 64 114
44 96 178
52 112 210
68 144 274
76 160 306
92 192 370
116 240 466
124 256 498
132 178 530
138 242 554
148 304 594
156 206 626
164 336 658
172 352 690
174 302 698
186 322 746
188 384 754

7 Likes

Thanks a lot ! it actually helped

1 Like

Thanks, your test cases helped me pass Validator 5 but I still can’t get through validator 4.
My program is solving all your test cases correctly, could you please provide some more?

EDIT:
I solved it, here’s the test case that helped me -
1992 1708 7970

2 Likes

Thanks for the examples, i could modify my code to finally beat validator #5, but #4 remained unsolved. I noticed the flaw with my original desing and completly reworked my algorith, but im now stock with failing at test #4 and validator #5.

-Kyto

Solved it! For anyone having trouble: N stays small anough that brute force is viable.

1 Like