Submit | All submissions | Best solutions | Back to list |
CLOPPAIR - Closest Point Pair |
You are given N points on a plane and your task is to find a pair of points with the smallest Euclidean distance between them.
All points will be unique and there is only one pair with the smallest distance.
Input
First line of input will contain N (2<=N<=50000) and then N lines follow each line contains two integers giving the X and Y coordinate of the point. Absolute value of X,Y will be at most 10^6.
Output
Output 3 numbers a b c, where a, b (a<b) are the indexes (0 based) of the point pair in the input and c is the distance between them. Round c to 6 decimal digits.
See samples for more clarification.
Input:
5
0 0
0 1
100 45
2 3
9 9
Output:
0 1 1.000000
Input:
5
0 0
-4 1
-7 -2
4 5
1 1
Output:
0 4 1.414214
Added by: | SALVO |
Date: | 2011-04-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Standard Problem |
hide comments
|
|||||||||
2015-03-16 16:54:01 Kamil Debowski
guys, be careful about "Round c to 6 decimal digits." |
|||||||||
2015-02-06 06:41:21 S Akira Sai Karthik
Getting wrong answer after test case 12 any idea ??? |
|||||||||
2014-08-23 18:00:52 Chuyên Nhật CNN
I think the test cases are week :| |
|||||||||
2014-07-31 13:48:14 Erdem Kirez
Be careful about output. "(a<b)". |
|||||||||
2014-02-06 13:08:40 bat2009fifa
you can never trust double or even long double more than long long int. i got ac by paying attention to this trick. |
|||||||||
2013-11-09 18:56:51 innovolt
any spcl test case...getting WA after 12th test case |
|||||||||
2013-08-25 18:34:14 Ashutosh Singla
take care of limits Last edit: 2013-08-26 21:22:42 |
|||||||||
2013-02-22 19:15:11 i_hate_myself
getting wrng ans on 12th test case...give me some more test case.. ??? |
|||||||||
2013-02-15 22:09:13 Monkey D. Luffy
pheww it got up to 12th test case then wa... |
|||||||||
2013-02-06 13:02:27 Utkarsh Shahdeo
Last edit: 2013-05-29 05:43:06 |