0% found this document useful (0 votes)
39 views2 pages

Problem L Treasure Protection: Time Limit: 2 Seconds Memory Limit: 1024 Megabytes

The document describes a problem from a programming contest about protecting treasures in a museum. The museum is modeled as a convex polygon defined by n vertex coordinates. There are m treasures located inside the polygon. Guards need to install fences forming two triangles of minimum total area to protect the treasures. The input specifies the vertex and treasure coordinates for multiple test cases. The output should be the minimum total triangular area or -1 if no solution exists.

Uploaded by

Thu Hằng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Problem L Treasure Protection: Time Limit: 2 Seconds Memory Limit: 1024 Megabytes

The document describes a problem from a programming contest about protecting treasures in a museum. The museum is modeled as a convex polygon defined by n vertex coordinates. There are m treasures located inside the polygon. Guards need to install fences forming two triangles of minimum total area to protect the treasures. The input specifies the vertex and treasure coordinates for multiple test cases. The output should be the minimum total triangular area or -1 if no solution exists.

Uploaded by

Thu Hằng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

The 2020 ICPC Vietnam Southern Provincial

Programming Contest
University of Science, VNU-HCM
October 25, 2020

Problem L
Treasure Protection
Time Limit: 2 seconds
Memory Limit: 1024 megabytes

Recently, the very famous VNU Museum has been attracting many students
and visitors from around the world. Thus, the treasures in the museum could
be in danger and we have to protect them. In order for the managers of the
museum to guard the treasure against stealing, they decided to install fences
around all the treasures.

We can consider the museum is a convex polygon whose vertices are the corners, and the
treasures are points inside the polygon. The fences that will be installed form 1 or 2 triangles
(noted that the common area of these triangles is 0), and the vertices of these triangles must be
the vertices of the polygon.
The managers of the museum hope that the fences cause the least inconvenience for the visitors,
so the total areas of the two triangles should be as small as possible.
In other words, given 𝑛 vertices on 𝑂𝑥𝑦 plane, which are the corners of the museum, and the
position of the 𝑚 treasures in the museum, find the minimum total areas of the guard regions.

Input
 The first line contains an integer 𝑡 – the number of test cases. Each test case has the following
structure:
o The first line contains two integers 𝑛, 𝑚 (3 ≤ 𝑛 ≤ 2000; 1 ≤ 𝑚 ≤ 2000) – the number
of the corners, and the number of treasures, corresponding.
o In the next 𝑛 lines, the 𝑖𝑡ℎ line contains two integers 𝑥𝑖 , 𝑦𝑖 (−109 ≤ 𝑥𝑖 , 𝑦𝑖 ≤ 109 ) ,
the coordinate of the 𝑖𝑡ℎ corner. They are listed in counter-clockwise direction.
o In the next 𝑚 lines, the 𝑗𝑡ℎ line contains two integers 𝑥𝑗 , 𝑦𝑗 (−109 ≤ 𝑥𝑗 , 𝑦𝑗 ≤ 109 ),
the coordinate of the 𝑗𝑡ℎ treasure.
16
The 2020 ICPC Vietnam Southern Provincial
Programming Contest
University of Science, VNU-HCM
October 25, 2020
 It is guaranteed that all the treasures are inside the museum, and there are no three collinear
points among the given 𝑛 + 𝑚 points.
 The total number of vertices in all test cases are not greater than 2000.

Output
 Print −1 if there is no possible solution.
 Otherwise, print the minimum total areas of the two guard regions. The output must contain
exact 3 digits after the floating point.

Sample Input Sample Output


3 8.000
4 1 -1
0 0 54.000
5 0
4 4
0 4
2 3
5 3
0 0
6 -6
11 0
8 4
3 4
3 2
7 3
8 -2
8 4
-4 -4
0 -7
4 -4
6 0
4 4
0 7
-4 4
-6 0
-2 -5
2 -5
3 2
-3 2

17

You might also like