Well, let it simplify / explain a bit. Suppose our cars are unit squares, N x N parking, and we need to enter / exit the lower left corner. A simple template gets almost 2/3 of the full machine (shown for N = 12):
+------------+ |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| |C CC CC CC C| | -----------+
I can prove that the best you can do is get a 2/3 batch. Imagine that you are building empty spaces, starting with a completely full garage and driving out of the (if possible achievable) car one at a time. Each time you rent a car, you produce up to 3 new available cars and delete one available car (now an empty space). Therefore, for each place you make, you create no more than two available cars. To make 2/3 N ^ 2 reachable cars, you need to make at least 1/3 N ^ 2 spaces and all the squares that you have. Thus, you can fill the garage by a maximum of 2/3.
The simple pattern above is asymptotically optimal, since its density approaches 2/3 as N → infinity. (I miss you, I was hoping that some kind of tree drawing would be better.)
Keith randall
source share