514 - Rails
There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to establish only a surface track. Moreover, it turned out that the station could be only a dead-end one (see picture) and due to lack of available space it could have only one track.
The problem requires reordering items on a stack, specifically to determine if the reordering can be done in a single pass.
5 1 2 3 4 5 5 4 1 2 3 0 6 6 5 4 3 2 1 0 0
Yes No Yes
- Reference 1
Categories here, use the form [[Category:UVa Online Judge|514]] [[Category: Category Name]], see Categories for a list