Still editingOK, lets look at the problem first.
I think we can...
Ok, I think this is the first one of these that I’ve attempted to answer and I may be repeating another answer. I haven’t read them yet. Anyway... we can turn the problem into a binary such. We’re going to use the property that each pair of corridors has a single dead end room connecting them. Ifsearch!
To do this we first have to notice a few things about the problem. Each dead end room has two doors exiting it. One to the corridor that you came from and one to the adjacent corridor.
From this property we can apply this logic...
If we number the doors from 1 to 2001 (from west to east) then we notice that at the start of the corridor the doors 1-2, 3-4, 5-6, and so on will share a room. Always with the odd numbered corridor to the leftwest and the even numbered corridor to the righteast. At the end of the corridor the doors 1996-1997, 1998-1999, 2000-2001 will share a room always with the even numbered corridor to the leftwest and the odd numbered corridor to the right. We’ll call this property the “parity” of the dead end room. Odd parity is with the odd number on the left. Even parity is with the even number on the lefteast. This is because at some point along the main corridor our escape route takes up one of the numbers on its own. This means that the next corridor shifts the parity along by one. Further toWe’ll call this we know thatproperty the “parity” of the dead end room. Odd parity is with the odd number on the west. Even parity is with the even number on the west.
Further to this we know that...
...the escape route must be an odd numbered door. Otherwise we would have to have a dead end room to the west of the escape that only has a single door back out of it. So, we can perform a binary search by using the following logic i.e. there must be an even number of corridors to the west and east of the escape. Starting
So, we can perform our search by using the following "algorithm"...
Starting with the range 1-2001 pick an odd number half way along the range. (1001 in this case). Now enter the corridor and walk to the end. If the door is the escape we’re done. If not note which way the doors are arranged in the dead end room. If you enter on the righteast of the room then the escape route is a higher numbered corridor than the one you’re in. (And vice versa). So adjust the range up (for odd) or down (for even) based on the parity of the dead end room. 1-1000 for even and 1002-2001 for odd. Now repeats the steps using the new range. On average thisIf needed you may keep a not of the current range on your piece of paper but two numbers is not hard to remember :D
Performance of this escape...
This is a binary search (which I first thought we could use) and so has speed of log(n) which is about 11. !So(where n = 2001). So the length of time for this search would be .11 hours. 1 hour (to walk to the north end of each chosen corridor and back) * 11 (the number of corridors you would have to search).
So we can definitely escape in less than a week. It just takes half a day of lots of walking.