#P6802. [CEOI 2020] 道路
[CEOI 2020] 道路
Description
The government of Treeland plans to build a brand-new road network. Treeland has a total of cities. Currently, roads have already been built, and each road is a line segment connecting two cities. These roads do not intersect each other in pairs (including at endpoints). You now need to build another roads, such that:
- Each road is a line segment connecting two cities.
- Roads may intersect only at endpoints.
- For any two cities, it must be possible to travel between them using this road network.
Input Format
The first line contains an integer .
The next lines each contain four integers , indicating that there is a road directly connecting the two cities at and .
Output Format
Output lines.
Each line contains four integers , representing a newly built road connecting the two cities at and .
If there are multiple solutions, output any one.
5
1 3 3 6
5 1 5 3
3 3 6 5
2 1 4 1
2 3 4 2
2 1 1 3
2 3 2 1
3 3 2 3
5 1 4 2
Hint
Sample Explanation
In the figure below, solid lines are roads that have already been built, and dashed lines are new roads.

Subtasks
All testdata satisfy: , .
The constraints for each subtask are as follows:
| Subtask ID | Score | Constraints |
|---|---|---|
| Sample | ||
| All input segments are vertical | ||
| Any two input segments are parallel | ||
| All input segments are horizontal or vertical | ||
| No special constraints |
Note that the actual scoring distribution in the judge is different from the agreement above.
Translated by ChatGPT 5
京公网安备 11011102002149号