Dungeon Crawler
문제
In the famous video game Wizards & Wyvern, the protagonist finds himself in some kind of maze structure and has to find a way out. Each level is constructed with several caves, platforms, rooms or other kind of interesting spots that are connected with paths of different types. In each spot, there is a single distinguishable and unique artefact that can be activated by the hero. To escape from one level, the player has to activate the correct artefacts in the correct order. Riddles hidden inside the maze help him to solve the level.
You hate riddles and therefore obtained a map of a single level and its solution from the internet. You only need to find out whether this map represents the current level you are in.
While wandering around from spot to spot, the player can see the artefact in his current spot as well as all paths leading away from it. The game implements 26 different types of paths such as paved roads (P), bridges (B) or dirt roads (D). In each spot all paths leading away are of different types.
This is an interactive problem. You do not know your initial position but you can always decide which path to follow. For each spot you visit, you are provided with the name of the artefact there and the types of paths leading away. Your task is to find out whether this level matches the one on your map.
예제
예제 1
3 2 D 2 B 3 2 P 3 D 1 2 P 2 B 1 fountain DB obelisk PD crystals PB fountain DB
W D W P W B R 1
예제 2
3 2 D 2 B 3 2 P 3 D 1 2 P 2 B 1 obelisk PD fountain LD
W D R no
예제 3
2 2 P 2 D 2 2 D 1 P 1 fountain PD obelisk PD fountain PD
W P W D R ambiguous