Connecting Supertrees
문제
Gardens by the Bay is a large nature park in Singapore. In the park there are towers, known as supertrees. These towers are labelled to . We would like to construct a set of zero or more bridges. Each bridge connects a pair of distinct towers and may be traversed in either direction. No two bridges should connect the same pair of towers.
A path from tower to tower is a sequence of one or more towers such that:
- the first element of the sequence is ,
- the last element of the sequence is ,
- all elements of the sequence are distinct, and
- each two consecutive elements (towers) in the sequence are connected by a bridge.
Note that by definition there is exactly one path from a tower to itself and the number of different paths from tower to tower is the same as the number of different paths from tower to tower .
The lead architect in charge of the design wishes for the bridges to be built such that for all there are exactly different paths from tower to tower , where .
Construct a set of bridges that satisfy the architect's requirements, or determine that it is impossible.