아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Computer Network

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

요약
임의의 두 컴퓨터 사이 최단 경로에 포함된 중간 컴퓨터 수를 알려주는 질의만 사용해, 정해진 횟수 안에 a에서 b로 가는 실제 최단 경로를 찾는다.
난이도

보통10점 중 7점

유형
그래프, BFS, 최단 경로, 구현
정답자
아직 제출이 없습니다

문제

There are N computers in the computer classroom of a local secondary school and they are connected with cables to form a single network. Each cable joins two distinct computers. Some pairs of computers may not be joined by a cable directly, but a message can always be sent from any computer to any other computer through intermediate computers joined by cables. A message always chooses the shortest route to travel: the number of intermediate computers along its path (i.e. computers other than sender and receiver that the message visits) is minimised.

Adam and Billy, who use distinct computers a and b in this classroom, wish to determine a shortest route between their computers. They do not know the layout of the cables but they can send messages between all pairs of computers and calculate the number of intermediate computers that they visit.

However, Adam and Billy are not very good with computers and they ask you for help to achieve their goal without sending too many messages.

Find a shortest route between computers a and b without sending more messages than is allowed.

제한

In all subtasks the constraint 2 ≤ N ≤ 1000 holds.

예제

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