E - Straight Path 解説 by evima
For \(N=2\) or \(N=3\), it is impossible to satisfy the condition. For \(N=5\), as shown in the sample, a case with maximum label \(4\) can be constructed. Also, for \(N=5\), we can confirm by exhaustive search that no construction with maximum label \(3\) or less is possible. Let us show that in the other cases, we can construct a solution with maximum label \(3\), and it is impossible to achieve a maximum label of \(2\) or less.
First, prove by induction that in a complete graph where every edge is labeled \(1\) or \(2\), one can take a path visiting all vertices whose sequence of edge labels is non-decreasing. Let us take a path \((p_1,p_2,\dots,p_{N-1})\) satisfying the condition for the graph \(G'\) without vertex \(N\). If all labels of the edges of this path are equal, we can append vertex \(N\) at the beginning or the end. Otherwise, we can take an \(i\) such that the edge between \(p_i\) and \(p_{i+1}\) is labeled \(1\) and the edge between \(p{i+1}\) and \(p_{i+2}\) is labeled \(2\). Then, if the edge between \(p_{i+1}\) and \(N\) is labeled \(1\), we can insert vertex \(N\) as \((p_1,\dots,p_i,p_{i+1},N,p_{i+2},\dots,p_{N-1})\), and if the edge is labeled \(2\), we can insert vertex \(N\) as \((p_1,\dots,p_i,N,p_{i+1},p_{i+2},\dots,p_{N-1})\), completing the proof.
Next, we show a construction that achieves a maximum label of \(3\). Partition the \(N\) vertices into four sets \(X_0, X_1, X_2, X_3\), satisfying \(|X_0| \ge |X_1| \ge |X_2| \ge |X_3| \ge |X_0| - 1\). Then, do the following for the edges between \(X_i\) and \(X_j(i \le j)\):
- For \((i,j) = (0,1), (2,3)\), assign label \(1\).
- For \((i,j) = (0,3), (1,2)\), assign label \(2\).
- For \((i,j) = (0,0), (1,1), (2,2), (3,3), (0,2), (1,3)\), assign label \(3\).
Let us assume that we can take a path on this graph with non-decreasing edge labels. Assume that the starting point is in \(X_0\). Then, the path can have one of the following two forms:
Go back and forth between \(X_0\) and \(X_1\) multiple times. Then, go back and forth between \(X_0\) and \(X_3\) multiple times. Finally, travel between vertices of \(X_0\) and \(X_2\) in some way.
Go back and forth between \(X_0\) and \(X_1\) multiple times. Go from \(X_0\) to \(X_1\). Then, go back and forth between \(X_1\) and \(X_2\) multiple times. Finally, travel between vertices of \(X_1\) and \(X_3\) in some way.
In the former form, \(|X_0| \ge |X_1| + |X_3| + 1\) must hold, which is impossible. In the latter form, \(|X_1| \ge |X_0| + |X_2|\) must hold, which is also impossible.
If the starting point is in \(X_1\), \(X_2\), or \(X_3\), the following equalities must hold, which are also impossible.
- \(|X_1| \ge |X_0| + |X_2| + 1\)
- \(|X_0| \ge |X_1| + |X_3|\)
- \(|X_2| \ge |X_3| + |X_1| + 1\)
- \(|X_3| \ge |X_2| + |X_0|\)
- \(|X_3| \ge |X_2| + |X_0| + 1\)
- \(|X_2| \ge |X_3| + |X_1|\)
Therefore, it is proved that the above construction satisfies the condition.
Note that if \(|X_0| \ge |X_1| \ge |X_2| \ge |X_3| \ge |X_0| - 1\) does not hold, the condition might not be satisfied. For example, if \((|X_0|,|X_1|,|X_2|,|X_3|) = (2,1,2,1)\), we have \(|X_0| \ge |X_1| + |X_3|\), which we do not want.
投稿日時:
最終更新: