#1073
Unrated
PASTELE
시간 제한
5s
메모리 제한
256MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Goran Gašić

Mirko recently got N crayons as a gift. The color of each crayon is a combination of three primary colors: red, green and blue. The color of the ith crayon is represented with three integers: Ri for the red, Gi for the green and Bi for the blue component. The difference between the ith and the jth crayon is max(|Ri - Rj|, |Gi - Gj|, |Bi - Bj|). The colorfulness of a subsequence of crayons is equal to the largest difference between any two crayons in the subsequence. Mirko needs a subsequence with K crayons with the smallest colorfulness for his drawing. The subsequence does not have to be consecutive. Find it!

입력

The first line of input contains integers N and K (2 ≤ K ≤ N ≤ 100 000). The ith of the folowing N lines contains three integers Ri, Gi and Bi (0 ≤ Ri, Gi, Bi ≤ 255).

출력

The first line of output should contain the smallest colorfulness of a subsequence with K crayons. The following K lines should contain the R, G and B values of the colors of the crayons in the subsequence, in any order. Any subsequence that yields the smallest colorfulness will be accepted.

예제 입력 1

2 2
1 3 2
2 6 4

예제 출력 1

3
1 3 2
2 6 4

예제 입력 2

3 2
3 3 4
1 6 4
1 1 2

예제 출력 2

2
3 3 4
1 1 2

예제 입력 3

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

예제 출력 3

2
6 2 7
4 1 5
6 2 6
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.