Kero has just downloaded the Klivvr app and completed registration.
Kero is now ready to pick up his Klivvr card š³. There is a numerous
list of branches that Kero can visit to pick up his card. But Kero
is a bit lazy, so he wants to minimize the distance he travels. He
aims to visit the nearest cool š branch to his home. A
branch is considered cool if the distance between the branch and
Kero's home is an integer that's the result of multiplying an odd
number by itself. For example, if a branch is 9 kilometers away from
Kero's home, then it's cool because 9 is the result of multiplying
3, which is an odd number, by itself (3 * 3 = 9).
Kero lives in a 2D plane a.k.a
Euclidean plane. You are given the coordinates of Kero's home and the coordinates
of the branches. Kero asked you to help him find the nearest cool
branch to his home. If such branch doesn't exist, print -1. If there
are multiple answers print the one that appears first in the list of
branches.
(-103āā¤āx, yāā¤ā103) ā The coordinates of Kero's home.
(1āā¤āNāā¤ā103) ā The number of Klivvr branches.
(1āā¤ā|Si|āā¤ā50) ā The name of the i-th branch, consists
of lowercase and uppercase English letters only.
(-103āā¤āXi, Yiāā¤ā103)
ā The coordinates of the i-th branch.
The output should consist of a single line containing the name of the nearest cool branch to Kero's home or -1 if no such branch exists.
2 2
4
Heliopolis -7 2
Zamalek 2 5
Maadi 2 -2
Zayed -13 -18
Heliopolis
Kero is located at (2, 2). We have 4 branches.
Heliopolis is located at (-7, 2). The distance between Kero's home and Heliopolis is 9, which is cool.
Zamalek is located at (2, 5). The distance between Kero's home and Zamalek is 3.
Maadi is located at (2, -2). The distance between Kero's home and Maadi is 4.
Zayed is located at (-13, -18). The distance between Kero's home and Zayed is 25, which is cool as well.
We have 2 cool branches, Heliopolis and Zayed. Heliopolis is the nearest cool branch to Kero's home.
Made with
by
Kerollos Magdy
UI was originally developed by
Amr Salama
for the
2019 AFCON challenge
The winners will be announced soon