Expansion Work
Time limit3sMemory limit1024 MB
After each new sign is added, print the perimeter and area of the smallest convex polygon that contains all signs placed so far.
- Level
Medium7 of 10
- Topics
- Geometry, Binary search, Implementation
- Solved
- No attempts yet
Problem
Kiwi is looking for new land to grow eggplants. Kiwi's friend Yutil suggested placing signs on flat ground and starting the farm there. However, Kiwi can only farm inside the convex polygon with the smallest area that contains all the given signs.
Kiwi started farming. Yutil came to check on the farm, was moved to see Kiwi working hard on the eggplants, and said: "I will place one new sign each day for the next days. Your new farmland is the convex polygon with the smallest area that contains all existing signs and the new sign. Congratulations! I also have to report the new farmland to the community center, so could you tell me the perimeter and area of the new farmland each day?"
Input
The first line contains the number of signs ().
Each of the next lines contains the position of a sign, and , separated by a space ().
The next line contains the number of new signs ().
Each of the next lines contains the position of a new sign, and , separated by a space ().
No two signs are at the same position, and the first three signs are not on a single line.
Output
Print lines, each with the perimeter and area of the new farmland. An absolute or relative error of up to is allowed.