But if we have to cover points by square, how can the first sample has answer 4 ?
4
-1 -1
1 -1
1 1
-1 1
11243 - Texas Trip
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11243 - Texas Trip
Ok.
Lets back again to the this case
4
10 1
10 -1
-10 1
-10 -1
It is coordinates of rectangle
So the longest line length is 20 - so the minmum square will be 400, why correct result is 242?
Lets back again to the this case
4
10 1
10 -1
-10 1
-10 -1
It is coordinates of rectangle
So the longest line length is 20 - so the minmum square will be 400, why correct result is 242?
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11243 - Texas Trip
Draw it out. The square you're thinking of with corners at (-10,-10),(-10,10),(10,10),(10,-10) will cover the 4 points with area 400. The square with minimum area 242 covering the 4 points has corners at (-11,0),(0,11),(11,0),(0,-11).
Check input and AC output for thousands of problems on uDebug!