Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    That's very clever! I think if someone manage to find a monte-carlo approach to a problem like this, he deserves the solve :P

  • Custom User Avatar

    It's Python, so I can't really say anything about it. You've written more code than some "legitimate" solvers, so you just may have a valid solution for all I know.

    Could some of the Python guys comment? Do we need more, easier tests? Or just more? Do we congratulate Sean for being clever, and persistent in submitting?

    How often did you have to submit?

  • Custom User Avatar

    Picture this instead of customers and queues as buckets and water.

    if I have 3 buckets, and 20, 15, 30, 12 oz of water, what is the minimum possible weight that a bucket can have?
    bucket1 = 0 add 20 here
    bucket2 = 0 this is still empty add 15 here
    bucket3 = 0 this is still empty add 30 here

    but that leaves 12 oz left over, how to find the best place to pour? Find the lowest possible bbucket which is bucket 2
    bucket2 = 15 add 12 oz here which gives us 27

    what is the fullest bucket (or in the code example the highest amount of time that a line at the grocer can take?)
    the answer is bucket 3 which is 30.
    what if we had an additional 12 to that?

    bucket1 is only 20, being the lowest, we pour 12 into bucket 1
    bucket1 = 32 now, this would be the new minimum possible weight distributed among 3 buckets.

  • Custom User Avatar

    Oh, you're talking about Python.

    I don't know about the Python test cases. If Python test cases are broken like that maybe you should ask @GiacomoSorbi since he's responsible for the Python translation apparently (from comments below)

  • Custom User Avatar

    I think this is a good question, since "0" is in the test cases.

  • Custom User Avatar

    Is that a question?

    In any case, since the requirement doesn't use it, it's just that. If someone feel like it they can also change to requirement to 'a'=2600, 'b'=2500, ... 'z'=100, '!'=42, '?'=69, ' '=-1, and it's perfectly fine as well.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hi- thanks for putting in the time to write out your thoughts- I'm sorry the instructions confused you so much! (as it has done to others as well unfortunately). I will try to update the description and sample tests when I get time.

    With respect to your questions, I believe you have misinterpreted that there is one queue and many tills. I appreciate this is not how supermarket queues usually work, but this is how they work with self-checkout tills (in the UK at least). So the queue order never changes and it never splits into multiple queues. The diagram on the wiki page for thread pools is pretty accurate for the situation I was going for.

    Again, apologies that the instructions were misleading- I will try to clear things up a bit, and thanks for the feedback.

  • Custom User Avatar

    I like your answer too, thank you for taking the time to explain that!