Administrator’s task

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 8

Solved: 4

Description
    Naughty boys and girls enjoy drawing simple polygons and coloring them on the floor. And each kid is only to be allowed to draw and color one. The coordinate where anyone of them draws his or her polygon is not limited, even the areas that have been painted would also be allowed to be covered. However, it is not a good piece of news for Ryan, the administrator who has to keep the floor clean. And, to scrub the floor, Ryan would follow the rules such as:

1.      If somewhere (even one point) has been covered three times or more, he will refuse to scrub the floor;

2.      To scrub the areas have been covered once, Ryan will only use the cleanser A;

3.      Only by using the cleanser A and the cleanser B at the same time, the areas that have been covered twice can be totally cleaned up.

4.      The amount of cleanser A and B equals to the area where Ryan use them to.
Input
    The first line of the input file contains a single integer t (1≤t≤20), the number of test cases, followed by the input data for each test case. There is a blank line after each case.

 

    The description of each case starts with a line containing an integer n, (1≤n≤10) the total number of girls and boys. Then, the following n lines contain the information of the each polygon. Each line starts with an integer mi(3≤mi≤20), which is the number of the vertexes of the polygon which is drawn by the ith kids and the following are 2*mi integers which are the coordinate of every vertexes which are clockwise: xi1,yi1,xi2,yi2…xim,yim (-10000≤xi,yi≤10000).

Output
    Ouput only one line for each case. If Ryan refuses to finish his task, the result is a single integer -1. Otherwise, output the amount of cleanser A and B which will be used and a space between them. These two values should be rounded to 2 digits after the decimal point.

sample input
2
3
4 0 0 0 2 2 2 2 0
3 1 0 -3 0 -1 2
3 2 0 4 2 6 0

3
4 0 0 0 2 2 2 2 0
3 1 0 -3 0 -1 2
3 1 0 3 2 5 0
sample output
11.50 0.50
-1
hint
source
Hourui WU
© 2015 HUST ACMICPC TEAM. All Right Reserved.