1 /*
2 宋代李冠
3 《蝶恋花·春暮》
4 遥夜亭皋闲信步。
5 才过清明,渐觉伤春暮。
6 数点雨声风约住。朦胧淡月云来去。
7 桃杏依稀香暗渡。
8 谁在秋千,笑里轻轻语。
9 一寸相思千万绪。人间没个安排处。
10 */
11 #include <cstdio>
12 #include <cstring>
13 #include <algorithm>
14 #include <cmath>
15 #include <queue>
16 #include <vector>
17 #include <iostream>
18 #include <string>
19 #include <ctime>
20 #include <map>
21 #define LOCAL
22 #define c(a, b) (a - 1) * n + b
23 const int MAXN = 105 + 10;
24 const long long MOD = 1000000007;
25 const double Pi = acos(-1.0);
26 const int MAXM = 60 * 2 + 10;
27 using namespace std;
28 typedef long long ll;
29 int read(){
30 int x = 0, flag = 1;
31 char ch = getchar();
32 while(ch < ‘1‘ || ch > ‘9‘) {if (ch == ‘-‘)flag = -1; ch = getchar();}
33 while(ch >= ‘0‘ && ch <= ‘9‘) {x = x * 10 + (ch - ‘0‘); ch = getchar();}
34 return x * flag;
35 }
36 int n, m;
37 int tot, A, B, d[25];
38 double p[25];
39 double a[400 + 10][400 + 10];
40 vector < int > G[25];
41
42 //建图,x1x2为原始房间,y1y2为移动后的房间
43 void build(int x1, int x2){
44 a[c(x1, x2)][c(x1, x2)]--;
45 for (int i = 0; i < G[x1].size(); i++)
46 for (int j = 0; j < G[x2].size(); j++){
47 int y1 = G[x1][i], y2 = G[x2][j];//移动后的房间
48 int c1 = c(x1, x2), c2 = c(y1, y2);//移动后的坐标
49 if (y1 != y2){
50 if (y1 == x1 && y2 == x2) a[c1][c2] += p[y1] * p[y2];
51 else if(y1 == x1) a[c1][c2] += p[y1] * (1 - p[y2]) / d[y2];
52 else if(y2 == x2) a[c1][c2] += p[y2] * (1 - p[y1]) / d[y1];
53 else a[c1][c2] += (1 - p[y1]) * (1 - p[y2]) / d[y1] / d[y2];
54 }
55 }
56 }
57 //高斯消元
58 void Gauss(){
59 int now = 1;
60 for (int i = 1; i <= tot; i++){
61 int tmp;//主元
62 for (tmp = now; !a[tmp][now] && tmp <= tot; tmp++);
63 for (int j = 1; j <= tot + 1; j++) swap(a[now][j], a[tmp][j]);
64
65 for (int j = 1; j <= tot; j++){
66 if (j == now) continue;
67 //又犯2B错误了... 这个一定要提出来啊
68 double t = a[j][now]/a[now][now];
69 for (int k = 1; k <= tot + 1; k++) a[j][k] -= t * a[now][k];
70 }
71 now++;
72 }
73 }
74
75 void init(){
76 memset(d, 0, sizeof(d));
77 memset(G, 0, sizeof(G));
78 memset(a, 0, sizeof(a));
79
80 n = read(); m = read();
81 A = read(); B = read();
82 tot = n * n;//总共的状态数量
83 a[c(A, B)][tot + 1] = -1;
84 for (int i = 1; i <= n; i++) G[i].push_back(i);
85 for (int i = 1; i <= m; i++){
86 int u = read(), v = read();
87 d[u]++;//度数
88 d[v]++;
89 G[u].push_back(v);
90 G[v].push_back(u);
91 }
92 for (int i = 1; i <= n; i++) scanf("%lf", &p[i]);
93 for (int i = 1; i <= n; i++)
94 for (int j = 1; j <= n; j++) build(i, j);
95 }
96 void print(){
97 for (int i = 1; i <= n; i++){
98 int tmp = c(i, i);
99 printf("%.6lf", a[tmp][tot + 1] / a[tmp][tmp]);
100 if (i != n) printf(" ");
101 }
102 }
103
104 int main(){
105
106 init();
107 Gauss();
108 print();
109 return 0;
110 }