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

23550번 - Road Construction 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 256 MB222100.000%

문제

There are $n+m$ towns in Kingdom of Coffee Chicken, which can be seen as $n+m$ integers coordinates $(x_i,y_i)$ on the 2-dimensional plane. $n$ of them belong to Acesrc while the other $m$ towns belong to Roundgod.

Now both Acesrc and Roundgod want to build straight roads among their towns and they all want their towns are connected, which means there is a path between any two of towns. It is obvious that we need only $n+m-2$ roads to make it possible. Moreover, Acesrc and Roundgod hope that among these $n+m-2$ roads, there is no intersection other than the position of towns.

Now we hope you to provide us a construction plan.

입력

The first line contains two integers $n,m(n>1,m>1,n+m \leq 3000)$.

The following $n$ lines describe Acesrc's towns and each line contains two integers $x,y(0 \leq x,y \leq 10^9)$ representing coordinates. Their number is 1ドル-n$ respectively.

The following $n$ lines describe Roundgod's towns and each line contains two integers $x,y(0 \leq x,y \leq 10^9)$ representing coordinates. Their number is 1ドル-m$ respectively.

There is no repeated coordinates among those $n+m$ towns. We also guarantee that no three towns are on the same straight line among them.

출력

Please output $n+m-2$ lines in total, the first $n-1$ lines representing the construction plan of Acesrc's towns and the other $m-1$ lines representing the construction plan of Roundgod's towns. For each line of a construction plan, please output two integers $x,y,ドル indicating a straight road connected town $x$ and $y$.

If it is impossible to find any valid construction plan, output Impossible instead.

제한

예제 입력 1

2 3
0 0
1 1
1 0
0 1
2 3

예제 출력 1

2 1
1 3
3 2

힌트

출처

Contest > Open Cup > 2019/2020 Season > Stage 17: Grand Prix of Nanjing (by Legilimens+Coffee Chicken) E번

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

출처

대학교 대회

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

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