You are a delivery person for the finest peanut butter and jelly sandwich restaurant in Riddler City. City streets are laid out in a grid, and your restaurant is on the corner of 20th Street and Avenue F. The city has 61 east-west streets, numbered 1st to 61st, and 21 north-south avenues, named A to U.
While traveling on a given street or avenue, you can drive at 20 mph, and the blocks are all 0.1 miles long. The exception is Avenue U, also known as the Ultra-Speed Trafficway, upon which you can drive at 200 mph. (You don’t need to worry about slowing down for traffic or turns.)
What are the parts of the map for which it’s helpful to use the Ultra for your deliveries, assuming you always start at 20th and F?
This is the most Excel-friendly Classic I can remember, and I pretty much think in Excel, so that’s how I tackled this one.
I started thinking about this problem in the wrong way: I was trying to get some sort of mental image of how the ultra-fast lane distorts the space. I got nowhere. After a while I saw that it was easier to tackle it as a different question: how much time do you gain by using the ultra-fast lane, and what do you give up to do it? So I decided to compare travel times with and without using the ultra-fast lane.
One thing to remember: on normal grid-layout city streets, there are no shortcuts. If you have to go 10 blocks east and 6 blocks south, your total travel distance won’t change if you south then east, east then south, or mix them up in any way. As long as you never go further than you need to in any direction, your total distance travelled can never be improved. I think of this as being because there are no diagonal streets (that would be shortcuts), but maybe a better mathematician can give a better explanation.
First I created an Excel tab showing the time (in minutes) taken to travel to different intersections without using the ultra-fast lane. Since there are no shortcuts, the total distance is simply the north-south distance plus the east-west distance. Think of it as going north or south along Avenue F, and then east or west along whichever street your destination is on, until you arrive.
The formula for this is
0·3*(ABS(ROW()-20)+ABS(COLUMN()-6)). Breaking it down:
- 0·3 is the number of minutes taken to travel one block (0·1 mile) at 20mph.
- row() is the number of the current row.
- row()-20 is the north-south displacement (in blocks) from 20th Street. For instance, to travel from 20th and F, our starting point, to 16th and F, requires a displacement of 16 – 20 = -4 blocks. This is equivalent to going four blocks north.
- abs(row()-20) is the total north-south distance we need to travel, regardless of direction. Continuing the previous example, abs(-4) = 4, so the total north-south distance we have to travel is four blocks.
- abs(column()-6) does the same for east-west travel. It calculates the number of blocks that we need to travel to get to a new intersection, assuming we start at Avenue F (column 6).
Then I created a second tab, showing how long it would take to get to a particular intersection by using the ultra-fast lane on Avenue U (or column U, in my spread sheet). For this tab, I calculated how long it would take to reach the destination by travelling in three steps:
- east from the starting point, 20th and F, until we reach the ultra-fast lane at 20th and U, then
- north or south from 20th and U until we reach our destination street, then
- west from Avenue U until we reach our final destination.
The formula for this is:
Parts of this are the same as in the first formula:
- 0·3 at the start is unchanged
0·1*(ABS(ROW()-20))is unchanged for calculating north-south distance, except for the 0·1 at the start. That is there because we now take the ultra-fast lane, and travel north-south ten times as fast as we did. Ten times the speed, so 0·1 times the time for the same distance
ABS(COLUMN()-6)is still the same for calculating east-west distance between the start and end points.
IF(ROW()<>20,2*(21-MAX(6,COLUMN())),0)is new in this formula, and it adds on the extra distance we have to travel to get to Avenue U and back. That extra distance is zero if we are already on 20th Street (there is no north-south distance to travel). If we are on another street, the extra distance is two times the distance to Avenue U from the closer of either the starting point or the destination.
Thirdly, the easy part. With the two different calculations on two different tabs, I made a third tab, which works out which of the two possible travel methods, using the fast lane or avoiding it, is best. We end up with this:
The interesting thing is the shape of the area where it is faster to take Avenue U than to avoid it. That’s the area shaded grey in this picture:
Ignore the bottom few lines (55th Street and below) and the main pattern on the right is a diamond. The further you have to go north or south, the more likely you are to want to use Avenue U. And the further you have to go east, towards Avenue U, the more likely you are to want to go a little bit further east to get to Avenue U.
Below 55th Street, there’s no diamond. Even if we’re delivering to 55th and F, it’s still faster to go to Avenue U first and then south, rather than using a more direct route. For any Street in the city, if it’s faster to get to the intersection of that Street and F by using Avenue U than by going direct, then it’s also faster to use Avenue U for that Street and any avenue west of F.
Overall, using Avenue U removed north-south time, and adds east-west time. If the amount of time removed is more than the amount of time added, then it’s faster to use Avenue U. That is, we should use Avenue U when:
time saved > time added
Since we go 10 times as fast on Avenue U, we save 90% of the time we would otherwise take to travel north-south:
0·9 × north-south distance > time added
And since the extra distance we travel depends on how far west we would travel if we weren’t using Avenue U,
0·9 × north-south distance > 2 × (21 – minimum(6, destination avenue number))
Lastly simplifying. We should use Avenue U when this is true:
0·45 × north-south distance > (21 – minimum(6, destination avenue number))
That deals with which intersections we should travel to via Avenue U. I think you can extend the solution by finding what the boundary looks like at a more detailed level than just intersection-by-intersection, but that’s enough for now.