20 points · by jaekwon · 16y ago · 39 comments
Is there some standard testing package that these are both using? Otherwise it seems fishy.
http://www.google.com/search?q=%22All+submissions+must+execu...
1 jar1:2
2
3 jar2:3
4
5
6 jar1:2 jar2:4
7
8
9 jar2:6
10
11
12 jar1:11 jar2:3
13
14
15Yes, I really did imagine all kinds of cases involving zero time and negative time rules (or having zero time to produce anything) and tried to conform them to the spec, but most of them conflict with the output requirements. Not all, though...
BTW, the original solution yields 27 whites: 5 from the start, and then jar1 is used 2+3+3+3=11 times, yielding 22 more.
I noticed the solution in the article is in a "steady state", that can produce 6 whites every 3 steps, or 2 whites per step. The better solution by tlb produces 26 whites in 8 steps, but I didn't check whether it is sustainable (in the sense that after those 8 steps we have enough material to start over).
It's an interesting problem, and I couldn't even model it after a first glance using a graph or linear programming. Will try again later :)
Start producing 4 more (2 jars) at timestep 1.
Start producing 4 more at timestep 6.
Start producing 22 more at timestep 12.
22 + 4 + 4 + 5 = 35
a) a known fail percentage - 40% of the time the Jar fails and produces nothing. Maximize expected win.
b) an unknown fail percentage, evenly distributed between 0 and 100%. Find a strategy that maximizes expected win over many runs (each run has new fail probabilities), by perfectly balancing between exploration of jars and exploitation. If you can find an optimal (and practical) strategy for this one I applaud you!
Also, I solved your example with a simple Python brute-forcer with < 1s run time. I don't know if I care enough to write a parser of your file format just to mail it in ;).
It has me wondering how 'loser' is defined and if a person can be their own 'friend' ... (read their riddle poem if that makes no sense to you).
My guess would be that the social graph needs to be planar (e.g embeddable on a plane so that no edges go across eachother).
The world is a sphere can be interpreted in too many ways. One would be that there exists a hamiltonian cycle for the graph and other would be that if you do a depth first search you'd always hit yourself eventually.
My strong guess would be that 2 friends is the least and the most a loser may have.
Biggest problem with too smart puzzles such as this is that there are way too many ways to legitimately interpret them.
But something tells me the solution is going to be a lot less simple though.
TL;DR - It gets to be a pretty messy/bad backpack and should probably be solved another way
So, brute-forcing this looks doable in a day, probably a lot less, as I took a high estimate for the branching factor. One instruction/cycle probably is on the high side, but that can be compensated for by using multiple cores.
1
2 jar1:1
3
4 jar2:3
5 jar1:1
6
7 jar2:4
8 jar1:1
9
10 jar2:6
11
12
13 jar1:12
14
15