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

19040번 - Labeled Points 다국어

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

문제

Consider $N$ points on the Cartesian plane. The points are labeled with positive integers from 1ドル$ to $N$. The points are special: for each point $(x_i, y_i),ドル the coordinates are positive integers, and the equality $x_i \bmod 2 = \lfloor y_i / 2 \rfloor \bmod 2$ holds.

Your task is to select a sequence of $K$ of those points with the following property: the distance between every pair of points from this sequence is not less than 2ドル$. Among all such sequences, find the one for which the sequence of the points' labels is lexicographically minimal.

입력

The first line of input contains two integers $N$ and $K$ (2ドル \le K \le N \le 6000$). Each of the next $N$ lines contains coordinates of a point: two integers $x_i$ and $y_i$ (1ドル \le x_i, y_i \le 10^9,ドル $x_i \bmod 2 = \lfloor y_i / 2 \rfloor \bmod 2$).

It is guaranteed that all given points are pairwise distinct.

출력

If it is impossible to select $K$ points so that the distance between every pair of them is not less than 2ドル,ドル print $-1$. Otherwise, print $K$ integers, one integer per line: the sequence with the desired property which is lexicographically minimal.

제한

예제 입력 1

3 2
2 1
1 2
1 3

예제 출력 1

1
3

예제 입력 2

4 3
2 1
1 2
1 3
2 4

예제 출력 2

-1

예제 입력 3

5 3
5 7
5 6
6 8
20 20
4 8

예제 출력 3

2
3
4

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 9: Japanese+ Selection L번

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

출처

대학교 대회

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

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