2000 Canadian Computing Competition, Stage 1
Problem S5: Sheep and Coyotes
A square 1000 by 1000 field contains several sheep. A coyote enters the field at some point in the south boundary and proceeds to eat the sheep closest to the point of entry, picking arbitrarily if more than one sheep is equally close. The coyote, being sated, then leaves the field.
Your job is to determine which sheep may be eaten by the coyote.
Assume that the southwest corner of the field is located at (0.00, 0.00), the northwest corner at (0.00, 1000.00), the northeast corner at (1000.00, 1000.00) and the southeast corner at (1000.00, 0.00). The first line of input gives the number of sheep, between 1 and 1000. For each sheep a pair of lines follows, giving its coordinates within the field (between 0.00 and 1000.00).
For each sheep that might be eaten print a line "The sheep at (x, y) might be eaten." where x and y give the location of the sheep to two decimal places. The sheep can be listed in any order in the output.
Sample Input
6 100.00 100.00 200.00 150.00 140.00 200.00 100.00 300.00 300.00 300.00 300.00 100.00
Sample Output
The sheep at (100.00, 100.00) might be eaten. The sheep at (300.00, 100.00) might be eaten.
All Submissions
Best Solutions
Point Value: 20 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 01, 2008
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
Again this will be a 20 point problem, so no points lost.
In other words, a sheep can be eaten if there exists at least one point on the fence such that the distance from that point to this sheep to this point is less than or equal to the distance from that point to any other sheep.
For example, (0, 10) and (1000, 11).
Obviously if the wolf comes in at coordinate 0 it's going to eat the first one, but if it comes in at coordinate 1000 it's going to eat the second one. Both sheep are "edible".