#P7460. [CERC2018] Trees Gump
[CERC2018] Trees Gump
Description
Translated from [CERC2018] Trees Gump.
In the Jumbarian rainforest, tall trees have great strategic value. The leader of the Jumbarian army chose trees that are close to each other, and decided to build a treehouse on each of the trees and station one army unit there. Transporting people and materials between trees relies on bidirectional cableways. For safety reasons, when viewed from a satellite, no two cableways cross each other.
Now army units have been selected, and a list of pairs of army units has been made. The two army units in the same pair should operate the same cableway from its two ends. The number of pairs is one less than the number of army units, which means connectivity in this area is guaranteed. That is, after assigning the army units, each army unit can reach any place using only the cableways that appear in the list.
The remaining task is how to install the cableways between the tree tops so that the army units can be assigned according to the rules above.
Input Format
The first line contains an integer , the number of tree tops and the number of army units. Both tree tops and army units are numbered .
The next lines each contain two integers, meaning that these two army units should be at the two ends of the same cableway.
The next lines give the coordinates of each tree top. Line contains two numbers , the coordinates of the -th tree. No three trees lie on the same straight line.
Output Format
Output lines describing an installation plan for the cableways. Each line outputs two numbers , meaning that a cableway is built between trees and .
If there are multiple solutions that satisfy the requirements, output any one of them.
5
0 1
1 2
2 3
3 4
0 0
9 9
2 3
3 2
7 8
0 3
3 1
1 4
4 2
3
1 2
0 2
0 0
1 1
2 3
0 1
1 2
Hint
, .
Translated by ChatGPT 5
京公网安备 11011102002149号