| Baozii Cup 1 |
|---|
| Закончено |
DreamChaser is excited about a new video game, Big Baozi, Small Baozi. In this game, he plays as a Baozi trying to consume other Baozi to grow bigger.
The game's map is represented by an undirected connected graph with $$$n$$$ vertices and $$$m$$$ edges. Each vertex contains a Baozi with a weight $$$w_u$$$ ($$$1 \leq u \leq n$$$).
The game consists of $$$q$$$ rounds. At the start of each round:
After the round begins, DreamChaser can perform the following operation repeatedly:
This process continues until there are no consumable neighbors left. For each round of the game, please help DreamChaser determine his final weight at the end of the round.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 1000$$$). The description of the test cases follows.
The first line of each test case contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n - 1 \le m \le \min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$, $$$1 \le q \le 2 \cdot 10^5$$$) — the number of vertices, edges, and rounds respectively.
The second line contains $$$n$$$ integers $$$w_1,,w_2,\ldots,w_n$$$ ($$$1 \le w_i \le 10^9$$$) — the weight of the Baozi on each vertex.
Each of the next $$$m$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$, $$$u \ne v$$$), representing an edge between vertices $$$u$$$ and $$$v$$$. It is guaranteed that there are no self loops or multiple edges in the graph.
Each of the next $$$q$$$ lines contains two integers $$$v$$$ and $$$x$$$ ($$$1 \le v \le n$$$, $$$0 \le x \le 10^9$$$) — the starting vertex and additional weight boost for each round.
It is guaranteed that the sum of $$$n$$$, $$$m$$$ and $$$q$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output $$$q$$$ integers, where the $$$i$$$-th integer represents the final weight of DreamChaser for the $$$i$$$-th round.
15 4 41 2 2 5 111 22 35 43 41 04 04 12 10
1 10 22 31
| Название |
|---|


