#P8389. [COI 2021] Izvanzemaljci
[COI 2021] Izvanzemaljci
Problem Description
Translated from COI 2021 T3 "Izvanzemaljci".
There are integer points on a 2D plane. Find pairwise disjoint squares such that all integer points lie inside or on the boundary of the squares. If there are multiple solutions, choose the one that minimizes the area of the largest square among all valid constructions. If there are still multiple solutions, output any one of them.
Two squares are considered disjoint if their edges do not intersect or touch, and neither square is completely contained within the other.
Input Format
The first line contains two integers and .
The next lines each contain two integers and .
Output Format
Output lines. Each line contains three integers , , and , indicating a square with lower-left corner and side length .
You must ensure that and .
3 1
1 1
1 3
2 2
0 1 2
5 2
1 3
3 1
5 5
5 10
7 7
1 1 4
5 7 3
5 3
1 3
3 1
5 5
5 10
7 7
1 1 2
5 5 2
5 10 1
Hint
Sample Explanation
Explanation for Sample #2:

Explanation for Sample #3:

Constraints
For all testdata, , , .
| Subtask | Constraints | Score |
|---|---|---|
| , | ||
| , | ||
Translated by ChatGPT 5