Theseus
시간 제한1초메모리 제한2048 MB
연결된 무방향 그래프의 모든 간선에 0 또는 1을 붙여, 시작 노드를 모르는 상태에서 기억을 쓰지 못하는 이동자가 어떤 s에서 출발해도 t까지 최단거리+14 이내에 도달하도록 라벨을 설계한다.
문제
If all the parts of the ship of Theseus are replaced one by one over time, at what point − if any − does it stop being the same ship?
When he's not pondering deeply into the abstract, Theseus slays minotaurs in his spare time. This time however, he must first pass through a dark and twisted labyrinth. Since this is no easy feat, he asks the help of Ariadne to guide him. The labyrinth can be seen as a connected undirected graph with nodes (labelled from to ) and edges, with a special node , where the Minotaur sits.
Theseus cannot see the graph at all, but Ariadne can. She and Theseus will devise a strategy so that he can safely reach the node where the Minotaur is: she will put a label with either or on each of the m edges. After this, Theseus will enter the labyrinth through a node that Ariadne doesn't know beforehand.
Since it's very dark, at any moment in time he can only see the index of the node he's in, the indices of neighbouring nodes, and the labels of the adjacent edges. Also, because of the twisted nature of the labyrinth, he can never recall any information regarding previous nodes he has visited.
To reach the Minotaur safely, Theseus must move at most times, where is the minimum number of edges on the path from to , and is a constant.
제한
- The start node is fixed for each test before calling function
label.
예제
이 문제는 공개된 예제가 없습니다.