VMSS Pre-Windsor P2 - Get Off My Lawn

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

The geese are invading, so Mr. White has bought a shotgun. He sits on his lawn chair in the middle of his lawn at the point (0, 0) (his lawn also happens to be a Cartesian plane). There are N geese that are standing on Mr. White's lawn, each one occupying a point with integer coordinates (A, B). Mr. White's shotgun is CR branded and thus has infinite ammo, is on full auto, and has sniper sights, so his only challenge is figuring out how far away he has to shoot. Which point contains the goose that is farthest away from him?

Input Specification

On the first line, the positive integer N (1 \le N \le 1\,000).
On the next N lines, two space-separated integers A and B (-50\,000 \le A,B \le 50\,000) denoting the position of a goose.

Output Specification

The space-separated coordinates representing the position of the goose farthest away from Mr. White at (0, 0). If two geese are at the same distance, pick the one that appears first in the input.

Sample Input 1

3 4
5 -12
-9 -3
7 7

Sample Output 1

5 -12

Sample Input 2

15 17
-4 10
13 -20
27 -1
-11 5

Sample Output 2

27 -1


  • -1
    John  commented on May 19, 2022, 6:17 p.m.

    Best DMOJ problem ever

  • -1
    CountT  commented on April 18, 2021, 8:04 p.m.

    By far the funniest problem statement! omegalul!