Dungeon Crawler

시간 제한7초메모리 제한512 MB

요약
지도로 주어진 그래프와, 시작 위치를 모르는 채 탐색하는 실제 레벨이 경로 종류까지 같은 그래프인지 판별하는 인터랙티브 문제다.
난이도

보통10점 중 7점

유형
그래프, DFS, 백트래킹, 해시맵
정답자
아직 제출이 없습니다

문제

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.

예제3

  1. 예제 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. 예제 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. 예제 3

    입력
    2
    2 P 2 D 2
    2 D 1 P 1
    fountain PD
    
    obelisk PD
    
    fountain PD
    
    
    예상 출력
    W P
    
    W D
    
    R ambiguous