#P14450. [ICPC 2025 Xi'an R] Directed Acyclic Graph
[ICPC 2025 Xi'an R] Directed Acyclic Graph
题目描述
Given two integers and , you need to construct a directed acyclic graph (DAG) with exactly vertices and edges.
In the graph , a vertex is called from vertex if and only if there exists a path in the graph that starts at vertex and ends at vertex .
For a non-empty set of vertices , a vertex is defined as for if and only if it is reachable from vertex in , and we denote as the set of all good vertices for .
The graph you constructed should satisfy both of the following constraints:
- For every vertex (), it is reachable from vertex .
- There exist distinct non-empty sets of vertices , such that are pairwise distinct. Note that can be empty.
To prove the graph you constructed satisfies the second constraint, you also need to provide sets that satisfy the second constraint.
输入格式
The only line of the input contains three integers , and .
There are only tests in this problem:
- , , ;
- , , .
输出格式
The first lines of the output describe the graph you construct. Each line contains two integers representing an edge from to in the graph.
The next lines of the output describe the sets of vertices you provide. The -th line first contains the size of the set , followed by the numbers representing each vertex in the set.
5 6 6
1 2
1 3
2 4
3 5
2 5
3 4
1 1
1 2
1 3
1 4
1 5
2 2 3
提示
In the example, the output constructs a graph with vertices and edges. The corresponding sets are $S_1 = \{1\}, S_2 = \{2\}, S_3 = \{3\}, S_4 = \{4\}, S_5 = \{5\}, S_6 = \{2, 3\}$.
Here, vertices and can both be reached from any element in , so . Together with $f(S_1) = \{1, 2, 3, 4, 5\}, f(S_2) = \{2, 4, 5\}, f(S_3) = \{3, 4, 5\}, f(S_4) = \{4\}, f(S_5) = \{5\}$, these sets are all distinct, satisfying the constraints.
:::align{center}
:::
京公网安备 11011102002149号