Skip to main content
Commonmark migration
Source Link

#The smallest circles

The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles must be minimal.
  3. The coordinates and radii of all three circles must be non-negative integers.

You must place all three circles. You may place overlapping circles. A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

#The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles must be minimal.
  3. The coordinates and radii of all three circles must be non-negative integers.

You must place all three circles. You may place overlapping circles. A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles must be minimal.
  3. The coordinates and radii of all three circles must be non-negative integers.

You must place all three circles. You may place overlapping circles. A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

Copy one of the conditions into the bulleted list in challenge description.
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40

#The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles ismust be minimal.
  3. The coordinates and radii of all three circles must be non-negative integers.

You must place all three circles. You may place overlapping circles. Each radius must be non-negative (zero is non-negative). A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

#The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles is minimal.

You must place all three circles. You may place overlapping circles. Each radius must be non-negative (zero is non-negative). A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

#The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles must be minimal.
  3. The coordinates and radii of all three circles must be non-negative integers.

You must place all three circles. You may place overlapping circles. A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

Fix incorrect test case. Make it clear that a zero radius circle can cover a point.
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40

#The smallest circles


WriteChallenge

This is a program thatvariant of the smallest-circle problem, givenbut instead of one circle, you get three. Given a list of xy-coordinatescoordinates, outputsoutput three circles such that completely enclose those coordinatesthe following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles is minimal.

You must place all three circles. You may place overlapping circles. Each radius must be non-negative (zero is non-negative). A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. TheUse whatever input format is not importantyou want to use.

Example:For example, the input...

1,1;1,2;2,2;3,3

enter image description here

Challenge

Given these coordinates, you must place exactly three circles such that the following two conditions are met... can be drawn like this:

  • Every coordinate must be located inside or on the perimeter of a circle
  • The sum of the radii of all three circles is minimal

You must place all three circles. Each radius must be non-negative (includes zero). You may place overlapping circles.enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Actual Test CaseTest case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

21,2,2;01;3,03,0;0,0,0

... or you could output...

1/2/1
3/3/10
0/0/0

The radii of both answers sum of 2sums to 1, and since it is not possible to draw a circle of radius smallerthree circles whose radii sum to less than 21 that encompassesencompass or touch all four points, either answerthis is validthe correct answer.


(maybe too)

#The smallest circles


Write a program that, given a list of xy-coordinates, outputs circles that completely enclose those coordinates.

Input

A list containing between 1 and 1000 pairs of integers. Each pair of integers represents an xy-coordinate. The input format is not important.

Example:

1,1;1,2;2,2;3,3

enter image description here

Challenge

Given these coordinates, you must place exactly three circles such that the following two conditions are met:

  • Every coordinate must be located inside or on the perimeter of a circle
  • The sum of the radii of all three circles is minimal

You must place all three circles. Each radius must be non-negative (includes zero). You may place overlapping circles.

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Actual Test Case

Given the input...

1,1;1,2;2,2;3,3

... you could output...

2,2,2;0,0,0;0,0,0

... or you could output...

1/2/1
3/3/1
0/0/0

The radii of both answers sum of 2, and since it is not possible to draw a circle of radius smaller than 2 that encompasses all four points, either answer is valid.


(maybe too)

#The smallest circles


Challenge

This is a variant of the smallest-circle problem, but instead of one circle, you get three. Given a list of coordinates, output three circles such that the following conditions are met:

  1. Each input coordinate must be located inside or on the perimeter of a circle.
  2. The sum of the radii of all three circles is minimal.

You must place all three circles. You may place overlapping circles. Each radius must be non-negative (zero is non-negative). A circle with a radius of zero that is directly on top of an input coordinate is considered to be covering that input coordinate.

Input

A list containing between 1 and 1000 pairs of integers, inclusive. Each pair of integers represents an xy-coordinate. Use whatever input format you want to use.

For example, the input...

1,1;1,2;2,2;3,3

... can be drawn like this:

enter image description here

Output

A list of three integer triples. Each triple contains an x coordinate, followed by a y coordinate, followed by a radius. The triples, and the integers within each triple, must be distinguishable from one another. Otherwise, the output format is not important.

Example:

1,1,1;2,2,1;3,3,2

Given this example output, circles would be drawn at (1,1), (2,2), and (3,3). The first two circles would have a radius of 1, and the third would have a radius of 2. The sum of the radii would be 4.

Test case explained

Given the input...

1,1;1,2;2,2;3,3

... you could output...

1,2,1;3,3,0;0,0,0

... or you could output...

1/2/1
3/3/0
0/0/0

The radii sums to 1, and since it is not possible to draw three circles whose radii sum to less than 1 that encompass or touch all four points, this is the correct answer.


(maybe too)

Per Martin's comment, edited the last example to use a delimiter that is not comma, to demonstrate that the output format is not strict.
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading
Relaxed the input and output formats
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading
Fix output title
Source Link
Loading
Added a restriction on the input size.
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading
added 52 characters in body
Source Link
Alex A. Mod
  • 24.7k
  • 4
  • 54
  • 90
Loading
Went into the test case in a little bit more depth. Removed an old reference that might have made more sense when I first posted this in the Sandbox.
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading
Mod Removes Wiki by Martin EnderMod
Post Made Community Wiki by Martin EnderMod
deleted 32 characters in body
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading
Addressing comments
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading
Source Link
Rainbolt
  • 6.4k
  • 24
  • 40
Loading