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

31105번 - Infection 다국어

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

문제

An emergency happened in one secret organization. In the middle of the working day, one of the employees was hospitalized with symptoms of an extremely dangerous colonavirus infection. In this regard, the management of the organization wants to establish which employees can still be infected, but the symptoms of the disease have not yet shown themselves.

There are $n$ employees in the organization, who can be numbered with integers from 1ドル$ to $n$. From the recordings of CCTV cameras, the organization's management established when which employees contacted each other. In addition, management took into account the following assumptions:

  • At the beginning of the working day, exactly one of the employees was infected, and each of the initial states could happen with a probability of 1ドル/n$.
  • If two employees come into contact with each other, and one of them is infected and the other is not, then a healthy employee becomes infected with a probability of 1ドル/2$. If both employees are healthy, or both are infected, nothing happens.
  • If an employee is infected, he cannot suddenly recover, that is, he remains infected until the end.
  • It is known that the employee numbered $k$ was eventually infected.

A chronological list of employees' contacts is given. Determine for each employee the probability of being infected according to the assumptions described above.

입력

The first line contains three integers $n,ドル $k$ and $m$ --- the number of employees, the number of the infected employee and the number of contacts, respectively (2ドル \le n \le 15,ドル 1ドル \le k \le n,ドル 1ドル \le m \le 50$).

The $i$-th of the following $m$ lines contains two integers $x_i$ and $y_i$ --- indexes of employees who participated in the $i$-th contact (1ドル \le x_i, y_i \le n,ドル $x_i \ne y_i$).

All contacts in the list are given in chronological order

출력

Print $n$ lines. On the $i$-th line print the probability of infection of the $i$-th employee as an irreducible fraction $a/b$. See the example for a more precise understanding.

제한

예제 입력 1

3 2 1
1 2

예제 출력 1

2/3
1/1
0/1

예제 입력 2

3 2 2
1 2
2 3

예제 출력 2

1/2
1/1
5/8

예제 입력 3

4 1 4
1 2
2 3
3 4
4 1

예제 출력 3

1/1
19/37
17/37
27/37

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 16: Grand Prix of Urals I번

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

출처

대학교 대회

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

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