CF1666C.Connect the Points

普及/提高-

通过率:0%

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 aa and bb are considered connected if there is a sequence of points p0=a,p1,,pk=bp_0 = a, p_1, \ldots, p_k = b such that points pip_i and pi+1p_{i+1} lie on the same segment.

输入格式

The input consists of three lines describing three points. Each line contains two integers xx and yy separated by a space — the coordinates of the point ( 109x,y109-10^9 \le x, y \le 10^9 ). The points are pairwise distinct.

输出格式

On the first line output nn — the number of segments, at most 100.

The next nn lines should contain descriptions of segments. Output four integers x1x_1 , y1y_1 , x2x_2 , y2y_2 on a line — the coordinates of the endpoints of the corresponding segment ( 109x1,y1,x2,y2109-10^9 \le x_1, y_1, x_2, y_2 \le 10^9 ). Each segment should be either horizontal or vertical.

It is guaranteed that the solution with the given constraints exists.

输入输出样例

  • 输入#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.

首页