#x1061. CF976F Minimal k-covering

CF976F Minimal k-covering

Minimal k-covering

题面翻译

题目大意

给你一张二分图 G=(U,V,E)G = (U, V, E)UU 是图的 XX 部, VV 是图的 YY 部, EE 是边集,可能有重边。

我们称 EE 的某个子集 E\overline Ek-覆盖 的,当且仅当图 G=(U,V,E)\overline G = (U, V, \overline E) 的每个顶点至少连接了 kk 条边;若 E\overline E 是 k-覆盖 的且不存在元素个数比它更小的边集也是 k-覆盖 的,则称 E\overline E 是一个 最小k-覆盖

你的任务是对于所有 k[0,minDegree]k \in [0, minDegree] ,求出 最小k-覆盖,其中 minDegreeminDegree 是图 GG 的所有点度数的最小值。

输入格式

第一行输入三个整数 n1n_1n2n_2mm1n1,n220001 \le n_1, n_2 \le 20000m20000 \le m \le 2000 ),分别代表 UU 的点数, VV 的点数和边数。

接下来 mm 行每行两个整数 uiu_iviv_i ,表示第 ii 条边在 UU 中的端点为 uiu_i ,在 VV 中的端点为 viv_i

输出格式

输出包含 minDegree+1minDegree + 1 行,每行首先输出一个整数 cntkcnt_k ,表示 最小k-覆盖 的边集大小,紧接着输出 cntkcnt_k 个整数,表示属于 最小k-覆盖 的边的标号。边按输入顺序从 11 开始标号。输出时不必按标号从小到大输出。

感谢@OrangeLee 提供的翻译

题目描述

You are given a bipartite graph G=(U,V,E) G=(U,V,E) , U U is the set of vertices of the first part, V V is the set of vertices of the second part and E E is the set of edges. There might be multiple edges.

Let's call some subset of its edges k k -covering iff the graph has each of its vertices incident to at least k k edges. Minimal k k -covering is such a k k -covering that the size of the subset is minimal possible.

Your task is to find minimal k k -covering for each , where minDegree minDegree is the minimal degree of any vertex in graph G G .

输入格式

The first line contains three integers n1 n_{1} , n2 n_{2} and m m ( 1<=n1,n2<=2000 1<=n_{1},n_{2}<=2000 , 0<=m<=2000 0<=m<=2000 ) — the number of vertices in the first part, the number of vertices in the second part and the number of edges, respectively.

The i i -th of the next m m lines contain two integers ui u_{i} and vi v_{i} ( 1<=ui<=n1,1<=vi<=n2 1<=u_{i}<=n_{1},1<=v_{i}<=n_{2} ) — the description of the i i -th edge, ui u_{i} is the index of the vertex in the first part and vi v_{i} is the index of the vertex in the second part.

输出格式

For each print the subset of edges (minimal k k -covering) in separate line.

The first integer cntk cnt_{k} of the k k -th line is the number of edges in minimal k k -covering of the graph. Then cntk cnt_{k} integers follow — original indices of the edges which belong to the minimal k k -covering, these indices should be pairwise distinct. Edges are numbered 1 1 through m m in order they are given in the input.

样例 #1

样例输入 #1

3 3 7
1 2
2 3
1 3
3 2
3 3
2 1
2 1

样例输出 #1

0 
3 3 7 4 
6 1 3 6 7 4 5

样例 #2

样例输入 #2

1 1 5
1 1
1 1
1 1
1 1
1 1

样例输出 #2

0 
1 5 
2 4 5 
3 3 4 5 
4 2 3 4 5 
5 1 2 3 4 5