아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Connect the Points

면접 대비

시간 제한3초메모리 제한512 MB

요약
세 점을 축에 평행한 선분으로 최소 총 길이로 연결하고, 그 선분들을 출력합니다.
난이도

보통10점 중 4점

유형
기하, 그리디, 구현
정답자
아직 제출이 없습니다

문제

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 p_0=a,p_1,…,p_k=bp\_0 = a, p\_1, \ldots, p\_k = b such that points p_ip\_i and p_i+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 (−109≤x,y≤109-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 x_1x\_1, y_1y\_1, x_2x\_2, y_2y\_2 on a line --- the coordinates of the endpoints of the corresponding segment (−109≤x_1,y_1,x_2,y_2≤109-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.

힌트

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

예제1

  1. 예제 1

    입력
    1 1
    3 5
    8 6
    
    예상 출력
    3
    1 1 1 5
    1 5 8 5
    8 5 8 6