Problem C
Jaguar Jump
Trekking in the Amazon rainforest sounds like a daunting task, but Jarvis and his friends are well-prepared and have found a good guide. Bringing the right equipment is of course essential: On top of the list is mosquito repellent, closely followed by waterproof covers to avoid a permanently wet rucksack.
The first couple of days were a pleasant experience for Jarvis, except for some annoying insects here and there. It also took some time to get used to all the noises during the night, and uh, pro tip: Close your mosquito nets before going to bed. But apart from a big snake that lead to a smaller detour, things have gone very smoothly.
…that is, until the jaguar appeared. Cutely named “El Investigador” by the local community, the jaguar is mostly curious and investigative when it comes to humans, and tends to keep a safe distance. Though after every night, “El Investigador” has been seen closer and closer to the camp we set up.
This morning, the tour guide is more unnerved than usual: He has spotted the jaguar very close to the camp! As we all know, Jaguars are known for their incredible jump distances, and so he’s afraid “El Investigador” could just jump straight into the camp.
You, on the other hand, aren’t quite so sure about that. But you’re not confident either, so you decide to fetch some real-time satellite images and quickly write a program to check whether the jaguar can jump straight into the camp.
Input
The first line contains three integers, $W$, $H$ and $D$, denoting the width and height of the satellite image, along with the maximal distance “El Investigador” can jump. Then follows a grid, spanning $H$ lines, each with exactly $W$ ASCII-characters each. The symbol “@” denotes the location of the camp, and the symbol “J” denotes the location of “El Investigador”.
Output
Output “no jumpscares here” if the Euclidean distance between the camp and “El Investigador” is strictly greater than $D$, otherwise output “the guide is right”. The distance between two grid locations is the distance between their $(x, y)$-coordinates.
Limits
-
$1 < W, H \leq 50$
-
$0 < D < 72$
-
The symbols in the grid will only be one of “.,:;-+*=~_^#%@J”
-
There is exactly one “@” and one “J” on the grid
Sample Input 1 | Sample Output 1 |
---|---|
10 5 6 ~~~~,...,+ ~~~~~~_+.+ ~~=^_~~_== ~~*#*_~~__ J_+#__@~~+ |
the guide is right |
Sample Input 2 | Sample Output 2 |
---|---|
6 7 3 ;:#_%^ ~~_@_^ ~~~__^ =~~~~* ;,J~~~ ..,-~~ --.^=~ |
no jumpscares here |