Spider-Man is fighting the Sinister Six. While fighting he was hit in the head But he somehow managed to defeat all six. For the damages he suffered, his stamina is limited. He wants to go home to rest as soon as possible. He is a few blocks far from home.
There lies buildings on the path to his way home, building from the start has unit of height. Spider-Man is initially standing on top of the building and his home is on top of the building. As he is damaged from his fight and cannot use his webs he will climb the buildings.
He loses unit of stamina for unit of height climbed up.
He gains unit of stamina for unit of height climbed down.
If he does not have the stamina left to climb up or down at any point before reaching home, he will be stuck and won’t be able to go home.
Now, Spider-man is wondering if he can reach his home if he starts with unit of stamina.
The first line will be a single integer indicating the number of buildings. In the next line, there will be space-separated integers, denoting the height of building . The next line will have an integer . Each of the next lines will contain an integer in each line denoting , the amount of stamina left after the fight.
You have to output lines for each query. You have to print “
Homecoming” if Spider-Man can reach home, “
No way Home”, otherwise.
7 1 4 3 6 2 3 4 6 3 5 2 10 1 6
No way Home Homecoming No way Home Homecoming No way Home Homecoming
5 1 3 4 1 5 2 3 4
No way Home Homecoming
In the second case the building heights are given in the second line.
1 3 4 1 5
Initially Spider-Man is on the first building.
The first query is for initial stamina, x=3.
The second query is for initial stamina, x=4.
Be careful about the newline(‘
\n’) at the end.