Hide

Problem C
Conundrum on the Roof

Languages en is
/problems/hi.conundrumontheroof/file/statement/en/img-0001.jpg
Image taken from commons.wikimedia.org
Soon the main event of the evening is closing in, the Striker-Count tournament that KFFÍ intends to watch together. However a minor problem came up, the video is being picked up via satellite and the satellite dish on the roof has lost its aim, so it needs to be adjusted. Eyleifur, a hero as always, offers to climb up onto the roof and take care of things. When he gets to the top of the ladder to the roof he notices that the roof is not only quite uneven but quite wet and thus slippery. Due to how slippery it is, Eyleifur will only take a step from one tile on the roof to another if the height difference isn’t too great. When Eyleifur finishes assessing the situation he jots down a sketch of the roof. Since turning on slippery surfaces can be a bit tricky Eyleifur will only move horizontally or vertically along the roof (seen from above).

Input

The first line of the input contains two integers $d_ U, d_ N$ satisfying $0 \leq d_ U, d_ N \leq 10^9$. $d_ U$ is the maximum height Eyleifur will scale upwards in a single step and $d_ N$ is the maximum height Eyleifur is the maximum height Eyleifur will scale downwards in a single step. The next line contains two integers $r, c$ satisfying $1 \leq r, c \leq 10^5$. They will also satisfy $rc \leq 10^5$. Next the input will contain $r$ lines each containing $c$ integers $h_{i, j}$ satisfying $0 \leq h_{i,j} \leq 10^9$. The numbers $h_{i, j}$ give the height map Eyleifur made of the roof. $h_{1, 1}$ is always equal to $0$ and is where Eyleifur climbs up onto the roof and begins his walk towards the satellite dish. The last line of the input contains two integers $D_ i, D_ j$ satisfying $1 \leq D_ i \leq r$ and $1 \leq D_ j \leq c$ which give the location of the satellite dish.

Output

Print ‘Kvoldinu er bjargad!’ if Eyleifur can make it to the satellite dish and back to the ladder. If there is no way for Eyleifur to get to the satellite dish and back, print ‘Nu er Eyleifur i bobba!’.

Sample Input 1 Sample Output 1
1 2
3 3
0 2 6
1 3 5
2 3 4
3 3
Kvoldinu er bjargad!
Sample Input 2 Sample Output 2
1 0
2 3
0 5 4
1 2 3
1 2
Nu er Eyleifur i bobba!

Please log in to submit a solution to this problem

Log in