CF1666C.Connect the Points
普及+/提高
通过率:0%
时间限制:3.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given three points on a plane. You should choose some segments on the plane that are parallel to coordinate axes, so that all three points become connected. The total length of the chosen segments should be the minimal possible.
Two points a and b are considered connected if there is a sequence of points p0=a,p1,…,pk=b such that points pi and pi+1 lie on the same segment.
给你平面上的三个点。你需要在平面上选择若干条与坐标轴平行的线段,使得这三个点彼此连通。所选线段的总长度应尽可能小。
若存在一个点列 p0=a,p1,…,pk=b,使得每一对相邻点 pi 与 pi+1 均位于同一条所选线段上,则称两点 a 和 b 是连通的。
输入格式
The input consists of three lines describing three points. Each line contains two integers x and y separated by a space — the coordinates of the point (−109≤x,y≤109). The points are pairwise distinct.
输入包含三行,每行描述一个点。每行包含两个由空格分隔的整数 x 和 y —— 即该点的坐标(−109≤x,y≤109)。这三个点两两互不相同。
输出格式
On the first line output n — the number of segments, at most 100.
The next n lines should contain descriptions of segments. Output four integers x1, y1, x2, y2 on a line — the coordinates of the endpoints of the corresponding segment (−109≤x1,y1,x2,y2≤109). Each segment should be either horizontal or vertical.
It is guaranteed that the solution with the given constraints exists.
第一行输出 n —— 线段的数量,最多为 100。
接下来的 n 行应包含各线段的描述。每行输出四个整数 x1、y1、x2、y2 —— 对应线段两个端点的坐标(−109≤x1,y1,x2,y2≤109)。每条线段必须是水平或垂直的。
在给定约束下,保证存在满足要求的解。
输入输出样例
输入#1
1 1 3 5 8 6
输出#1
3 1 1 1 5 1 5 8 5 8 5 8 6
说明/提示
The points and the segments from the example are shown below.

示例中的点和线段如下图所示。

输入解题思路,AI测评打分。不知道怎么写?