Logo
(追記) (追記ここまで)

19680번 - Roads 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 32 MB154360.000%

문제

The government of Treeland wants to build a new road network. There are 2N cities in Treeland. The unfinished plan of the road network already contains N road segments, each of which connects two cities with a straight line. No two road segments have a common point (including their endpoints).

Your task is to determine N − 1 additional road segments satisfying the following conditions:

  1. Every new road segment must connect two cities with a straight line.
  2. If two segments (new or old) have a common point, then this point must be an endpoint of both segments.
  3. The road network connects all cities: for each pair of cities there is a path consisting of segments that connects the two cities.

입력

The first line contains N, the number of existing road segments. Each of the following N lines contains four integers: x1, y1, x2, y2, where (x1, y1) and (x2, y2) are the coordinates of the endpoints of the segment.

출력

You should print N − 1 lines, each of them containing four integers, x1, y1, x2, y2, where (x1, y1) and (x2, y2) are the coordinates of the cities that are the endpoints of a new road segment. If there are multiple solutions, your program may output any of them.

제한

  • 2 ≤ N ≤ 105
  • −107xi, yi ≤ 107

서브태스크

번호배점제한
115

All input segments are vertical

215

Each pair of input segments are parallel

315

Each input segment is either horizontal or vertical

415

N ≤ 10 000

540

No additional constraints

예제 입력 1

5
1 3 3 6
5 1 5 3
3 3 6 5
2 1 4 1
2 3 4 2

예제 출력 1

1 3 2 1
2 1 2 3
2 3 3 3
4 1 5 1

힌트

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2020 > Day 1 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /