#P12816. [NERC 2021] Connect the Points

    ID: 12596 Type: RemoteJudge 3000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 3 Uploaded By: Tags>2021Special JudgeICPCNERC/NEERC

[NERC 2021] Connect the Points

题目描述

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
3 5
8 6
3
1 1 1 5
1 5 8 5
8 5 8 6

提示

The points and the segments from the example are shown below.