QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100

#13452. Big Fish Eating Water

Estadísticas

The problem setter is lazy, the data is random, the problem is simple, and the approach is obvious. As long as you solve the problem, just mess around a bit and you will pass.


You are a big fish. Because you are in harmony with water, you swim extremely fast in it, so you swim around in the water every day.

Until one day, you wake up and find yourself in a maze consisting of several rooms and waterways. You easily obtain the map of this maze:

You find that this maze can be abstracted as an undirected connected graph, with no multiple edges or self-loops, and each edge belongs to at most one simple cycle. Rooms can be viewed as vertices, numbered from $1$ to $n$, and waterways can be viewed as edges, directly connecting two rooms.

The paths in the maze are intricate, but you see through the map at a glance. Although you know how to get out, you have to fulfill your glorious mission—to "roll" (work hard), so getting out is a matter for later. You find that it is difficult to see the path clearly when you are "rolling," so you choose to run around randomly, that is, a random walk.

Formally, you will choose one of all the waterways connected to the current room with equal probability and run directly to the other end of this waterway (you must stay on this waterway while running).

You know that you are not working hard at all, and you believe that you are very lucky, so you leave the burden of getting out of the maze to your "rp" (luck), and leave the small goal of hitting $151$ problems to yourself.

However, you do not know which room you started in. So you want to know for each room, if you start there, what is the expected number of waterways passed until you reach an exit, starting from the random walk.

Of course, according to convention, we need to take the expectation modulo $998244353$. It can be proven that the answer can always be expressed as a rational number $\frac{a}{b}$, and you only need to output $a \times b^{-1} \pmod{998244353}$.

Input

The first line contains three positive integers $n, m, C$, representing the number of rooms, the number of waterways, and the number of exits, respectively.

The second line contains $C$ positive integers $c_i$, representing the indices of the exits. It is guaranteed that the indices are distinct and each index represents a room.

The following $m$ lines each contain two positive integers $u_i, v_i$, representing a waterway.

Output

Output $n$ lines, each containing a non-negative integer in the range $[0, 998244353)$, representing the expected number of waterways passed starting from room $i$.

Examples

Input 1

6 7 1
1
1 2
2 3
2 4
3 4
2 5
2 6
5 6

Output 1

0
13
15
15
15
15

Input 2

6 7 1
3
6 4
4 5
5 6
4 1
1 2
2 3
3 4

Output 2

7
499122181
0
499122184
499122186
499122186

Input 3

20 24 3
15 20 10
17 13
13 20
20 17
2 20
13 9
9 19
19 13
17 4
4 3
3 17
13 1
1 7
7 13
15 1
8 20
16 4
18 9
4 6
6 5
5 4
11 13
10 3
12 7
14 9

Output 3

873463818
1
873463818
499122191
499122193
499122193
499122189
1
790276796
0
124780557
499122190
124780556
790276797
0
499122192
124780554
790276797
457528677
0

Subtasks

For some reason, the data for this problem is generated by similarly choosing a vertex with a smaller index than itself for each vertex to connect an edge. Such data is relatively random, and to a large extent, one can ignore the case of calculating the modular inverse of $0$ during the calculation process.

For all data, $2 \leq n \leq 10^5, 1 \leq m \leq 1.5 \times 10^5, 1 \leq C \leq n$.

For $5\%$ of the points, $n \leq 300$.

For another $5\%$ of the points, it is guaranteed that the abstracted graph is a tree.

For another $10\%$ of the points, it is guaranteed that there is at least one exit on every cycle of the abstracted graph.

For another $40\%$ of the points, it is guaranteed that $m = n$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.