QOJ.ac

QOJ

Time Limit: 12 s - 20 s Memory Limit: 1024 MB Total points: 20

#5809. Min Perimeter

统计

Problem

You will be given a set of points with integer coordinates. You are asked to compute the smallest perimeter of a triangle with distinct vertexes from this set of points.

Input

The first line of the input data gives you the number of cases, T. T test cases follow. Each test case contains on the first line the integer n, the number of points in the set. n lines follow, each line containing two integer numbers xi, yi. These are the coordinates of the i-th point. There may not be more than one point at the same coordinates.

Output

For each test case, output:

Case #X: Y

where X is the number of the test case and Y is the minimum perimeter. Answers with a relative or absolute error of at most 10-5 will be considered correct. Degenerate triangles — triangles with zero area — are ok.

Limits

Memory limit: 1 GB.

1 <= T <= 15

0 <= xi, yi <= 109

Small dataset (5 Points)

Time limit: 60 12 seconds.

3 <= n <= 10000

Large dataset (15 Points)

Time limit: 120 20 seconds.

3 <= n <= 1000000

Sample

1
10
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
Case #1: 5.656854
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.