Logo
(追記) (追記ここまで)

9350번 - Do Not Disturb! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB26000.000%

문제

Nicole and Noura are from the media team of the regional contest, Noura takes photos of the teams in the contest hall during the contest, meets up with Nicole, and then Nicole uploads them to the Facebook page of the contest. In order not to disturb the teams, the contest director sets some paths that Nicole and Noura can use while doing this task. These paths intersect with each other forming a graph.

Formally, you are given a graph of nodes representing the points of intersection and the end points of the paths. You are given also bidirectional edges connecting the nodes. Two nodes are considered neighbors if there is an edge connecting them. You can assume that it takes one time unit to pass any edge. At the start of the contest, Nicole and Noura are in two nodes (not necessarily different node). At each time unit Noura and Nicole will each choose a neighboring node to go to or choose to stay at their current nodes for a full time unit with each possibility having an equal probability of being chosen. Your task is to compute the expected number of time units before they meet for the first time in a predefined node (which has the machine that will be used for uploading photos).

입력

The first line of the input starts with an integer T representing the number of test cases.
Each test case starts with a line containing two space separated integers V and E with V representing the number of nodes and E representing the number of edges.

The second line of each test case has three space separated integers A, B and C where A is the starting node of Nicole, B is the starting node of Noura and C is the index of the node where they will meet.

E lines follow, each having two space separated integers F and T representing an undirected edge between nodes F and T (note that there is at most one edge between any pair of nodes and there is no edge from a node to itself)

  • 1 ≤ V ≤ 20
  • F, T, A, B, C are all zero based indices

출력

For each test case print on a single line the expected number of moves rounded to three decimal places, if they can never reach each other print "Impossible" instead.

제한

예제 입력 1

3
3 2
0 2 1
0 1
2 1
1 0
0 0 0
2 1
0 0 1
0 1

예제 출력 1

4.800
0.000
4.000

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > ACM Jordanian Collegiate Programming Contest > JCPC 2012 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /