#P6876. [COCI 2013/2014 #6] GRAŠKRIŽJA(征集spj)
[COCI 2013/2014 #6] GRAŠKRIŽJA(征集spj)
Problem Description
There are many crisscrossing streets, and all streets are two-way. The intersection of a horizontal street and a vertical street is called a crossroads.
Now we will place traffic lights at crossroads. If a road between two crossroads has no traffic light, then turning is dangerous; otherwise, it is safe.
It is considered acceptable as long as, between every pair of traffic lights, there exists at least one shortest path that is safe. You need to add some extra traffic lights to meet this requirement.
Input Format
The first line contains an integer , which is the initial number of traffic lights.
The next lines each contain two integers and , representing the coordinates of the -th traffic light.
All traffic lights have distinct coordinates.
Output Format
Output the positions of the new traffic lights. It is allowed to place multiple traffic lights at the same position. The number of added traffic lights must be less than .
2
1 1
3 3
1 3
3
2 5
5 2
3 3
3 5
5 3
5
1 3
2 5
3 4
4 1
5 2
1 5
3 3
3 5
4 2
4 3
Hint
Constraints
- .
- .
Notes
This problem is translated from COCI2013-2014 CONTEST #6 T6 GRAŠKRIŽJA.
Translated by ChatGPT 5