Submit solution
Points:
1
Time limit:
5.0s
C++11
1.0s
C++14
1.0s
C++17
1.0s
C++20
1.0s
Memory limit:
256M
Author:
Problem type
Problem Statement
You are given integer coordinates in a two dimensional plane.
Determine a path (going from point to point) which has a total Manhattan distance travelled of less than .
NOTE: The Manhattan distance of to is .
Input Statement
Your first line will contain . Your next lines will contain two space-separated integers each and representing the point on the two dimensional plane.
Output Statement
You should output points, containing each of the points you have been given, in the order of the path that you will take.
Constraints
Sample Cases
Input 1
6
0 0
0 1000000
1 1000000
1000000 0
1000000 1000000
1000000 1000000
Output 1
1 1000000
0 0
1000000 1000000
0 1000000
1000000 1000000
1000000 0
Explanation 1
To be honest, the sample cases won't really help, but they are here anyway. Notice any path you take in this case will have total distance travelled less than . Notice there are repeated coordinates and
Comments