Johny the farmer
All submissions for this problem are available.
Johny the Farmer has decided to plant potatoes. He quickly realized that he must build a net fence to keep animals from eating his precious plantation. But he only has 3 sticks which can act as vertical poles supporting fence; on the other hand, his supply of net is unlimited. Moreover, since the ground is extremely rocky, the poles can only be positioned in some special places on the field. So, he has decided that the fence must be triangular in shape, with vertices in the distinguished points. Quite naturally, he would also like to maximize the area of the field inside fence -- please help him achieve this goal!
Write a program which:
- reads from the input the coordinates of the points which can hold the poles,
- calculates the maximal possible area of the potato plantation.
First, an integer t, representing the number of test cases.
Each test case starts with an integer n (n≤106). In the next line there are n pairs of integers separated by spaces, xi, yi, which are the coordinates for i-th point where a pole can potentially be located (-10000≤xi,yi≤10000).
For each test case output a single integer - the area of the field surrounded by the fence, multiplied by 2.
Input 1 5 0 0 1 0 0 1 1 2 1 1 Output 2
|Time Limit:||0.104215 - 0.736202 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, SQL, kotlin, TEXT, CPP17, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.