#P15493. [ICPC 2025 APC] Three-Dimensional Embedding
[ICPC 2025 APC] Three-Dimensional Embedding
Description
An embedding of a graph in a space is a way of placing each vertex at a distinct point in that space and drawing each edge as a simple arc connecting its two vertices, so that no two arcs intersect except at a shared vertex. In this problem, we focus on embeddings in a three-dimensional space under certain conditions.
You are given a simple undirected graph with vertices and edges, which means there is at most one edge connecting any pair of vertices and each edge connects different vertices. The vertices are numbered from to , and the edges are numbered from to . Edge connects the two distinct vertices and . Each vertex is incident to at most five edges.
Find an embedding of the graph such that all of the following conditions are satisfied.
- Each vertex is embedded as a point in the space. The coordinates and must be integers between and , inclusive. All points must have distinct coordinates.
- Each edge is embedded as a polyline (a connected series of line segments) with the embedded points for vertices and as its endpoints. Each segment of the polyline must be parallel to the -, -, or -axis. Each node of the polyline must have integer coordinates between and , inclusive. Each polyline must have no more than nodes, counting its endpoints.
- Polylines must not have self-intersections. Distinct polylines must not share any point, except when they correspond to edges incident to the same vertex. In that case, they may share only that single endpoint.
Input Format
The first line of input contains two integers and (, ). The -th of the following lines contains two integers and ().
The input guarantees that each vertex is incident to at most five edges. Further, there are no parallel edges; that is, if , holds.
Output Format
First, output lines. The -th of these lines should contain two integers and , representing the coordinates where vertex is embedded. Then, output lines, where the -th line represents the polyline corresponding to edge , using the following format:
$$k \ x'_1 \ y'_1 \ z'_1 \ \cdots \ x'_k \ y'_k \ z'_k$$Here, is the number of nodes, which must be between and , inclusive. The points are the nodes of the polyline. The first point must be , and the last point must be . Each pair of consecutive points is connected by a segment to form the polyline. Each segment must have a positive length. Two consecutive segments may have the same orientation; for example, both can be parallel to the -axis.
The embedding that you output must satisfy all of the conditions mentioned above.
Under the given input constraints, it can be shown that there exists at least one valid output. If there are multiple outputs, any one of them will be accepted.
Notes on special judging:
You are provided with a command-line tool for local testing. You can download the file from DOMjudge. The tool has comments at the top to explain its use.
3 3
1 2
1 3
2 3
0 0
400 0
0 399
3 0 0 0 100 0 0 400 0 0
4 0 0 0 0 0 200 0 399 200 0 399 0
3 400 0 0 400 399 0 0 399 0
Hint
Explanation for the sample input/output #1
Figure B.1 illustrates the embedding represented by the sample output.
:::align{center}
:::
京公网安备 11011102002149号