Official editorial said:
Once all cells on the shortest path are known, sort them by their distance to $$$(1, 1)$$$, i.e., $$$d_1(x, y)$$$ values. Now, if there’s any “level” of the shortest path that contains exactly one cell, every shortest path much pass through this cell and two disjoint paths cannot exist. Otherwise, a valid pair of paths will always exist.
I am confused about how to prove this. After careful consideration, I came up with a rigorous proof.
I used the maximum flow minimum cut theorem.
Review: What is the Maximum Flow Minimum Cut Theorem?The Max-Flow Min-Cut Theorem states that in a flow network, the maximum flow from the source to the sink is equal to the capacity of the minimum cut that separates the source and sink.
What is cut? A cut in a graph is a way of dividing the set of vertices into two disjoint subsets. Note them as $$$S$$$ and $$$T$$$, where $$$s$$$ (source point) must belong to $$$S$$$ and $$$t$$$ (sink point) must belong to $$$T$$$. The edges that connect a vertex in one subset to a vertex in the other subset are called the cut edges. The minimum cut is the cut that has the smallest total capacity of these cut edges.
Since each node is visited at most once, we need to split node $$$x$$$ into $$$x$$$ -> $$$x'$$$ when constructing the flow graph. Let's say $$$dis[x]=dis[x']$$$.
Let's call the graph before and after split as "original graph" and "split graph". When there is no $$$x$$$ and $$$x'$$$ belongs to different $$$S/T$$$ sets, it is more convenient to analyze on the "original graph".
What I want to prove is that if the number of nodes at all "levels" is greater than $$$1$$$ (except for $$$s$$$ and $$$t$$$), then for all cuts in the "split graph", the number of cut edges is always greater than $$$1$$$.
Let $$$D[i]$$$ be the set of all nodes $$$x$$$ such that $$$dis[x] = i$$$.
- Case $$$1$$$: for each $$$D[i]$$$, there is no $$$x$$$, $$$y$$$ belongs to $$$D[i]$$$ satisfies $$$x∈S$$$ and $$$y∈T$$$.
-- In