Problem J
Töskupökkun
Languages
en
is
New autumn, new airline. There’s construction work going on at Keflavík so the new airline “Pow!” can make room for themselves.
Part of this process is laying out new belts where the luggage goes through a scanning gate that takes images of what is inside the bags. When purchasing a new such gate it is important that the gate is large enough to accommodate all bags. But sometimes the process can also be made faster by orienting the bags differently. The belt moves at $1 \mathrm{cm/s}$, so if a bag is $50 \times 50 \times 150$ centimeters, it would take $150$ seconds for it to go through, if it were laying on the belt. But if the gate is large enough it could stand upright and take only $50$ seconds. A larger gate costs more money, so they want to choose the smallest gate that could perform its duties in a reasonable timeframe.
The gate is always square, so it has the same height and width. For the scan to come out clearly, only one bag may go through the gate at a time. Furthermore, the bags must have four sides parallel to the gate and another flat on the belt.
Input
The first line of the input contains two integers $n$, the number of bags, where $1 \leq n \leq 250\, 000$, and $T$, the maximum number of seconds the bags can take to move through the gate, where $1 \leq T \leq 10^{18}$. Then there are $n$ lines, each with three integers $x, y, z$, the side lengths of the bags in centimetres, where $1 \leq x, y, z \leq 10^9$.
Output
Print the side length of the smallest gate that suffices in centimetres. If no gate size is enough, instead print “Omogulegt!”.
Sample Input 1 | Sample Output 1 |
---|---|
2 100 30 40 50 30 40 60 |
50 |
Sample Input 2 | Sample Output 2 |
---|---|
2 100 40 40 80 80 80 80 |
Omogulegt! |