Theseus

시간 제한1초메모리 제한2048 MB

요약
연결된 무방향 그래프의 모든 간선에 0 또는 1을 붙여, 시작 노드를 모르는 상태에서 기억을 쓰지 못하는 이동자가 어떤 s에서 출발해도 t까지 최단거리+14 이내에 도달하도록 라벨을 설계한다.
난이도

어려움10점 중 9점

유형
그래프, BFS, 그리디, 구현
정답자
아직 제출이 없습니다

문제

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 nn nodes (labelled from 11 to nn) and mm edges, with a special node tt, 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 00 or 11 on each of the m edges. After this, Theseus will enter the labyrinth through a node ss 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 min+Cmin + C times, where minmin is the minimum number of edges on the path from ss to tt, and CC is a constant.

제한

  • 1≤n≤10,0001 ≤ n ≤ 10\\,000
  • 1≤m≤50,0001 ≤ m ≤ 50\\,000
  • C=14C = 14
  • The start node ss is fixed for each test before calling function label.

예제

이 문제는 공개된 예제가 없습니다.