Can You Beat Monster?

Author: Efat Sikder

Problem Setter: Efat Sikder

Member, IUBAT IITS Programming Wing

Takeshi's Castle, a beloved and iconic TV show, has left a lasting impact on the world of game shows and entertainment. It is celebrated for its outrageous challenges and the enduring appeal of its humorous and inventive obstacles.

In Takeshi's Castle, there is a game segment where a contestant enters a castle filled with interconnected rooms, and a formidable monster awaits, poised to eliminate the contestant. If the monster successfully catches the contestant, the game ends instantly. If the player can make it to the exit room before the monster comes, then the player wins the game.

As a participant, you possess certain knowledge: the number of rooms within the castle, your initial starting room, the room-to-room connections, the location of exit room and the monster's initial location. Notably, the monster is highly intelligent and can predict your movement within the castle, aiming to intercept you.

Your role in this scenario is that of a programmer, and your task is to determine whether you can emerge victorious in the game or if the cunning monster will succeed in capturing you.

Input Format

The input consists of the following elements:

  • The first line contains two integers, N (1 ≤ N ≤ 105) and M (1 ≤ M ≤ 106), representing the number of rooms in the castle and the number of connections between rooms.
  • The subsequent M lines each contain two integers, U and V (1 ≤ U, V ≤ N), indicating that room U is connected to room V.
  • The next line includes one integer, W (1 ≤ W ≤ N), denoting the exit room.
  • The next line includes two integers, D and P (1 ≤ D, P ≤ N), denoting the positions of the monster and the player, respectively.

Output Format

Print "Yes, I will with this game!" without quotes if you can win.

Else print "Nooo. I failed this time, but I will not fail next time." without quotes.

Print a new line after printing the output.


7 8 5 2 1 7 5 7 1 4 2 6 4 6 6 3 1 2 3 7 5
Yes, I will with this game!
7 8 5 2 1 7 5 7 1 4 2 6 4 6 6 3 1 2 3 5 1
Nooo. I failed this time, but I will not fail next time.
Language Time Memory
GNU C 11 1s 512MB
GNU C++ 14 1s 512MB
GNU C++ 11 1s 512MB
Login To Submit