跳到正文

题解

题解:P16941 「LAOI-18」Locus

jlhj约 4 分钟
原文
文章信息与版本

文章信息

收录
2026年6月26日
更新
2026年6月28日
篇幅
约 4 分钟
题目
P16941

版本

  1. v1当前

Preface

Suggested rating: Yellow.

chinese

Problem Statement

Find the global minimum cut λ(G)\lambda(G) of graph GG.

Analysis

Conclusion first
λ(G)={0,n≤2n−2−⌊n3⌋,n≥3\lambda(G)=\begin{cases} 0, & n\le 2 \\ n-2-\lfloor\frac{n}{3}\rfloor, & n\ge 3 \end{cases}

Proof of the Conclusion

First observe that when n≤2n\le 2 there is no nontrivial cut, so the global minimum cut is 00.

The graph has N=n−2N = n-2 vertices, numbered 3,4,…,n3,4,\dots,n.

Simplify

If ∣S∣,∣S‾∣≥2|S|, |\overline{S}| \ge 2, then the lower bound for the cut capacity is 2(N−2)=2(n−4)2(N-2)=2(n-4) (because every partition where both sides have size at least 2 contains at least two crossing edges, which can be proved by divisibility). When n≥5n\ge 5, we have 2(n−4)≥n−2−⌊n/3⌋2(n-4) \ge n-2-\lfloor n/3\rfloor (equality holds only for n=5n=5), so the minimum cut must be a single‑vertex cut. For n=3,4n=3,4 the conclusion can be verified directly.

Graph definition

The figure shows the divisibility complement graph for n=10n=10. Vertex 33 is marked in red; the edges between it and other vertices are exactly the candidate minimum cut.

Vertices {3,…,n}\{3,\dots,n\}; if a∣ba\mid b or b∣ab\mid a, they are not connected.

Degree formula
deg⁡(k)=N−⌊nk⌋=n−2−⌊nk⌋\deg(k) = N - \left\lfloor \frac{n}{k} \right\rfloor = n-2 - \left\lfloor \frac{n}{k} \right\rfloor

(It is not connected to multiples of kk.)

Vertex with minimum degree

⌊nk⌋\left\lfloor \frac{n}{k} \right\rfloor decreases as kk increases   ⟹  \implies vertex 33 has the smallest degree (for n≥4n\ge 4; when n=4,6n=4,6 it ties with other vertices but this does not affect the conclusion).

Global minimum cut

As shown in the figure: After deleting vertex 33, the capacity is:

n−2−⌊n3⌋n-2 - \left\lfloor \frac{n}{3} \right\rfloor

This completes the proof of the conclusion.

Code
C++
#include<bits/stdc++.h>
using namespace std;
long long n; 
int main() {
	cin >> n;
	if (n <= 2) cout << 0;        
	else cout << n - 2 - n / 3;    
	return 0;
}
原文