CCC '00 S5 - Sheep and Coyotes

View as PDF

Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 16M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
Canadian Computing Competition: 2000 Stage 1, Senior #5

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).

Input Specification

The first line of input gives the number of sheep, between 1 and 100. For each sheep a pair of lines follows, giving its coordinates within the field (between 0.00 and 1000.00).

Output Specification

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


Sample Output

The sheep at (100.00, 100.00) might be eaten.
The sheep at (300.00, 100.00) might be eaten.


  • -3
    harry7557558  commented on March 25, 2020, 9:26 p.m.

    For those keep getting WA on case 5, this picture may help you.


    • 7
      Tomorrow  commented on May 25, 2020, 7:28 p.m.

      For those who keep getting WA on case 5, this picture might be helpful.

      official test case

      Each point represents a sheep. All sheep not colored in green might be eaten.

  • -1
    noYou  commented on March 11, 2020, 4:59 p.m.

    Why am I getting wa for all cases? I checked the official test data, and my program matches the expected output?

    • 1
      Togohogo1  commented on March 11, 2020, 11:27 p.m. edited

      Make sure to format your output to 2 decimal places.

  • 3
    45628andy  commented on Feb. 6, 2019, 1:54 a.m.

    Still confused by case 5... Any hint will be appreciated

  • 6
    AntonyVer2  commented on Nov. 17, 2018, 5:01 p.m.

    Can someone shed some light on case 5?

    • 3
      hfanalytica  commented on Feb. 27, 2019, 12:26 p.m.


      • -13
        Roronoa_Zoro1540  commented on Feb. 1, 2020, 8:47 p.m.

        This comment is hidden due to too much negative feedback. Click here to view it.

  • 23
    Epic1Online  commented on Nov. 16, 2017, 6:11 p.m.

    The question doesn't seem to specify where the coyote enters from other than the southern boundary, does this mean it can enter at any point at the 'bottom'?

  • 2
    rlin264  commented on Aug. 24, 2017, 3:12 p.m.

    Whats is case 5 supposed to be? I keep getting WA for only case 5. Any hints?

  • -1
    septence123  commented on Feb. 7, 2017, 10:32 p.m.

    when I submit in PyPy2 I get MLE, even though it only uses around 5 mb when I submit it in python2? any reason for this?

    • 13
      Xyene  commented on Feb. 8, 2017, 12:45 a.m.

      Yes, the memory limit for this problem is 16M, and even a hello world program uses 30M in PyPy. That's the trade-off between performance and memory usage.

  • 6
    onlyIfStatement  commented on Jan. 3, 2017, 10:53 a.m.

    Is case 5 testing for a precision error or am i making another mistake?