Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Most isolated of 3 points [FINALIZED]

+1
−0

Now posted: Most isolated of 3 points


Given 3 points, output one that is separated from its nearest neighbour by the largest distance.

Input

  • 3 distinct points (that is, no 2 points are in the same position).
  • Each point is a pair of positive integers.

Output

  • A single point, as a pair of positive integers.
  • The distance between this point and its nearest neighbour must be greater than or equal to the distance from either of the other points to their nearest neighbour.
  • If all 3 of the input points have this property[1], you may output any of them, but you must output only 1 of them.

Examples

Example with a single valid output

Input points and distance to nearest neighbour:

1,3 : 1.4142135
2,2 : 1.0000000
3,2 : 1.0000000

Output:

1,3

Example with three valid outputs

Input points and distance to nearest neighbour:

6,5 : 3.6055512
4,2 : 3.6055512
9,3 : 3.6055512

All the nearest neighbour distances are the same, so any 1 of the following is a valid output:

6,5
4,2
9,3

Test cases

Note that if there is more than 1 valid output, you must output only 1 of them.

  • Test case are in the format inputs : outputs.
  • Inputs are in the format point1 ; point2 ; point3.
  • Outputs are in the format point1 | point2 | point3.
  • Points are in the format x,y.
3,3 ; 1,1 ; 3,1 : 3,3 | 1,1 | 3,1
3,3 ; 1,1 ; 2,2 : 3,3 | 1,1 | 2,2
3,1 ; 3,3 ; 2,2 : 3,1 | 3,3 | 2,2
1,3 ; 2,2 ; 3,2 : 1,3
3,2 ; 1,1 ; 3,1 : 1,1
9,1 ; 8,5 ; 5,4 : 9,1
3,2 ; 7,7 ; 3,1 : 7,7
6,5 ; 4,2 ; 9,3 : 6,5 | 4,2 | 9,3
1,9 ; 8,2 ; 6,9 : 8,2
9,8 ; 6,7 ; 5,9 : 9,8
2,4 ; 7,5 ; 1,7 : 7,5
9,6 ; 5,7 ; 5,4 : 9,6
9,6 ; 6,1 ; 9,4 : 6,1
7,9 ; 2,5 ; 2,2 : 7,9
6,8 ; 9,1 ; 9,3 : 6,8
85,6 ; 64,3 ; 95,19 : 64,3
5,24 ; 32,8 ; 74,46 : 74,46
36,38 ; 3,25 ; 30,46 : 3,25
60,34 ; 97,56 ; 59,86 : 59,86
17,49 ; 34,42 ; 20,60 : 34,42
14,10 ; 32,10 ; 78,26 : 78,26
8,68 ; 26,50 ; 88,74 : 88,74
29,82 ; 78,66 ; 1,83 : 78,66
51,65 ; 90,54 ; 66,8 : 66,8
80,28 ; 38,92 ; 73,85 : 80,28
31,97 ; 11,20 ; 19,57 : 31,97
83,45 ; 96,16 ; 16,97 : 16,97
95,59 ; 32,87 ; 57,90 : 95,59
17,33 ; 1,3 ; 45,20 : 1,3
11,16 ; 79,22 ; 84,6 : 11,16
36,9 ; 89,49 ; 45,78 : 36,9
8,53 ; 42,51 ; 28,78 : 8,53
77,21 ; 44,38 ; 84,20 : 44,38
66,58 ; 76,13 ; 67,84 : 76,13
76,45 ; 22,46 ; 33,74 : 76,45

Scoring

This is a code golf challenge. Your score is the number of bytes in your code. Lowest score for each language wins.

Explanations are optional, but I'm more likely to upvote answers that have one.


  1. It is not possible for exactly 2 of the input points to have this property. There will either be exactly 1 or exactly 3. ↩︎

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads