Izvanzemaljci | 프로그래밍의 벗 PivotOJ
PivotOJ

Izvanzemaljci

시간 제한: 2500ms메모리 제한: 512MB출처: CHC 2021 Croatian Olympiad in InformaticsBOJ 21809
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

It is a well-known fact that a group of Russian scientists discovered an alien civilization back in 2016. Their satellite managed to capture KK high-resolution square images that forever changed the course of human history. Today, half a decade later, almost every part of the world has its own space program that investigates aliens. Alas, in Croatia we have decided to tackle some more important problems, which leaves scientific research on the shoulders of few enthusiasts. Vladimir is one of them.

Unfortunately, Vladimir doesn’t have enough resources for a spacecraft or an expensive telescope, but he can afford a hot-air balloon and a mobile phone. Instead of an alien civilization, he decided to search for signs of intelligent life on his home planet. Looking down from the balloon, Vladimir notices exactly NN people. He decided to capture exactly KK square images of average resolution such that each person is seen on exactly one image. Also, he doesn’t want any detail to be visible on more than one image. Furthermore, he finds it important that the largest area visible on some picture is as small as possible.

Vladimir is not a great programmer, so he sent you a formal specification and awaits your help.

Formal specification

There are NN integer points in the coordinate system. You need to find exactly KK disjunct squares that cover all NN points. The squares must have sides parallel with the coordinate axes and their vertices should lie on integer coordinates. The area of the largest square needs to be as small as possible.

We say that a square covers a point if the point is fully inside it or lies on its vertices or sides. Two squares are disjunct if their sides doesn’t intersect or touch, and neither of the squares is fully contained in the other square.

입력

The first line contains integers NN and KK from the task description.

The ii-th of the next NN lines contains integers xix_i and yiy_i (0xi,yi1090 \le |x_i|, |y_i| \le 10^9) that represent the coordinates of the ii-th point (person). All NN points will be different.

출력

The ii-th of the KK lines should contain three integers xix_i, yiy_i (0xi,yi31090 \le |x_i|, |y_i| \le 3 \cdot 10^9) and lil_i (1li21091 \le l_i \le 2 \cdot 10^9), that uniquely define the location of the ii-th square, such that the point (xix_i, yiy_i) denotes its lower-left vertex, and lil_i denotes its side length.

If there are multiple correct solutions, output any of them.

힌트

Explanation of the second and third example:

[이미지 1]

예제

예제 1

입력
3 1
1 1
1 3
2 2
출력
0 1 2

예제 2

입력
5 2
1 3
3 1
5 5
5 10
7 7
출력
1 1 4
5 7 3

예제 3

입력
5 3
1 3
3 1
5 5
5 10
7 7
출력
1 1 2
5 5 2
5 10 1
코드를 제출하려면 로그인하세요.