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

7494번 - Dancers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB27222090.909%

문제

Alex missed the ballroom dance competition that he wanted to attend. So now he wants to know the pairs of dancers whose dancing he missed. He had several photos from the competition, so he chose one where all dancers are clearly visible and wrote down the coordinates of all N dancers (N is even).

Then Alex determined the pairs of dancers by the following algorithm: from not yet paired dancers he chooses two closest (to each other) dancers and assumes that they dance together as a pair. Should he find several pairs of dancers with the same minimum distance between dancers, he chooses lexicographically smallest pair (Alex enumerated dancers by integer numbers from 1 to N, dancers are ordered inside a pair, one with lower number goes first). You are asked to help Alex to determine pairs of dancers.

입력

The first line of input contains even integer N (2N300). Each i-th line of the next N lines contains two integers — x and y coordinates of i-th dancer. All coordinates are less than 108 by absolute value.

출력

You should output N/2 lines. Each line must contain numbers of dancers in the corresponding pair. The first number in a line should be less than the second. Lines must be sorted in the lexicographically ascending order.

제한

예제 입력 1

6
0 2
3 2
0 0
1 0
0 -2
2 -2

예제 출력 1

1 2
3 4
5 6

예제 입력 2

4
0 0
1 1
0 1
1 0

예제 출력 2

1 3
2 4

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > All-Ukrainian Collegiate Programming Contest > AUCPC 2010 D번

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

출처

대학교 대회

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

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