[Community Puzzle] Box of Cigars

Last test case “Need for Optimisations” seems to expect an answer of 13.

What’s wrong with the following sequence (19 cigars)? 321, 341, 361, 381, 401, 421, 441, 461, 481, 501, 521, 541, 561, 581, 601, 621, 641, 661, 681.

1 Like

Hello!
I have the same result: 19 cigars instead of 13 (the lengths the same too) at the last test.
And my solution fails this test.
The last validator on “Submit” fails too.
Is there errors in puzzle tests?

Hello,

The same here. I checked inputs manually and have the same result as JBM (19 values from 321 to 681).

2 Likes

Same here.
I had a look at the problem setter’s code, it got confused when the input contains the same number twice (as it happens in the last test + validator).
I edited the problem setter’s code and changed the expected result for the last test accordingly, please submit again.

1 Like

Yes sorry. I made practically the same DP implementation as the problem setter and did the same mistake of not handling duplicates correctly. I should have been more careful, thanks for pointing it out!

Geez. All four of problem setter + approvers get it wrong despite there being, from the start, a bold note to consider dupes. How many approvers do we need to get a reliable experience?

Not sure why any of you went DP on this, BTW. My crude O(N^3) passes it just fine.

I am very sorry for the inconvenience caused. Is it possible to change the tests without changing your solution? If so, please do so. I currently don’t have time to change my solution, but I’ll do it as soon as I can

It is possible to modify testcases.
And I already added one line to your code to remove duplicates.

I will increase the limit to make sure that doesn’t happen. Although you won’t have to worry about that, others will :wink:

Well that’s kind of unfair to them.

I know, but since the acceptors didn’t point it out, and the main purpose of the puzzle was to implement an efficient algorithm, I think its necessary. Although I am considering a Box of Cigars 2,which will require dynamic programming.
Please give me your opinion on what to do, update this, or add a new

My opinion is that published puzzles should never be changed. I can conceive of fixing bugs, but not changing the complexity class.

1 Like

Okay then, Box of Cigars II is coming up! :wink:

Box of cigars II is out now. Feel free to review, accept or refuse
Note: as in the first case, I do not intend a brute forced algorithm to work.

I’ve successfully passed all the test cases but the puzzle is not considered solved. Is it because I’ve used a brute force algorithm?

That shouldn’t happen. Did you pass all validators?

You mean the 7 test cases? Indeed :neutral_face:
And I have the same problem in another puzzle. I use PHP to solve the puzzles.

I am facing the same issue. All the test cases run successfully. But two validators are filing. Any chance I can find the validators input?

For the following list of cigars, what should the proper answer be?

10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13

CC: @Rafarafa