F. Rain of Fire SOLUTIONS CODEFORCES

Rain of Fire SOLUTION

There are n separations on a superficial level, numbered from 1 to n, the I-th separation is set in a point with arranges (xi,yi). All separations are set in various focuses.
Brimstone should visit every separation in any event once. You can pick the separation where Brimstone begins.
To move starting with one separation then onto the next he should initially pick one of four bearings of development (up, right, left or down) and afterward begin moving with the consistent speed of one unit span in a second until he goes to a separation. After he arrives at a discretionary separation, he can rehash a similar cycle.
Every t seconds an orbital strike covers the entire surface, so at that point Brimstone ought to be in a point where some separation is found. He can remain with any separation insofar as required.
Brimstone is a decent administrator, that is the reason he can make all things considered one separation and spot it in any unfilled point with number directions he needs before his excursion. Remember that Brimstone should visit this separation, as well.
Help Brimstone and find such negligible t that it is conceivable to check every separation. In the event that there is no such t report about it.
Info
The main line contains a solitary whole number n (2≤n≤1000) — the quantity of separations.
In every one of the following n lines there is a couple of whole numbers xi, yi (|xi|,|yi|≤109) — the directions of I-th separation.
It is ensured that all focuses are unique.
Yield
Yield such negligible number t that it is conceivable to check all the separations including all things considered one new separation.
In the event that there is no such t, print −1.
Models
inputCopy
4
100 0
0 100
– 100 0
0 – 100
outputCopy
100
inputCopy
7
0 2
1 0
– 3 0
0 – 2
– 1 – 1
– 1 – 3
– 2 – 3
outputCopy
– 1
inputCopy
5
0
0 – 1
3 0
– 2 0
– 2 1
outputCopy
2
inputCopy
5
0
2 0
0 – 1
– 2 0
– 2 1
outputCopy
2
Note
In the primary test it is conceivable to put a separation in (0,0), with the goal that it is conceivable to check all the separations for t=100. It very well may be demonstrated that it is difficult to check all separations for t<100; consequently the appropriate response is 100.
In the subsequent test, there is no such t that it is conceivable to check all separations, even with including all things considered one new separation, so the appropriate response is −1.
In the third test, it is conceivable to put a separation in (1,0), with the goal that Brimstone can check all the separations for t=2. It very well may be demonstrated that it is the negligible such t.
In the fourth test, there is no compelling reason to include any separations, in light of the fact that the appropriate response won’t beat that (t=2). It very well may be demonstrated that it is the negligible such t.

Leave a Comment

close
error: Content is protected !!