Security Guard

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

In JOI Kingdom, there are NN islands, numbered from 11 to NN. Each island has the insecurity level. The insecurity level of the island ii (1iN1 ≤ i ≤ N) is S_iS\_i.

In JOI Kingdom, ships between pairs of islands are mostly used as the methods of transportations. There are MM ships, numbered from 11 to MM. The ship jj (1jM1 ≤ j ≤ M) connects the island A_jA\_j and the island B_jB\_j. We can run ships when necessary. It is possible to travel from any island to any other island by taking a number of ships.

In JOI Kingdom, there is a plan to introduce new ships. We can choose any pairs of islands where newly introduced ships connect.

One day, an incident occurred. A ship at anchor was attacked. Prime minister K of JOI Kingdom decided to introduce new ships. He also demands that ships in JOI Kingdom should satisfy the following Security Condition.

  • When a ship is anchored at the island ii (1iN1 ≤ i ≤ N), the number of security guards on the ship is greater than or equal to S_iS\_i.

However, since it is expensive to hire security guards, we want to minimize the number of hired security guards. As long as the condition “it is possible to travel from any island to any other island by taking a number of ships” is satisfied, it is possible to abolish ships which are currently running.

Therefore, we will run ships as follows. Here, kk is the number of newly introduced ships.

  1. For each of the kk newly introduced ships, we choose two islands where it connects.
  2. We choose a number of (more than or equal to 00) ships, and we abolish them. It is allowed to abolish newly introduced ships.
  3. For each of the ships, we anchor it at one of the two islands where it connects. We make a number of security guards get on it. Moreover, the following conditions should be satisfied.

Condition: For every pair uu, vv (1uN1 ≤ u ≤ N, 1vN1 ≤ v ≤ N) of islands, it is possible to transport a passenger from the island uu to the island vv by repeating the following operations a number of times. In the process, Security Condition should be satisfied all the time.

  • We make a passenger or security guards get on a ship which is anchored at the island where the passenger or security guards are staying.
  • We make a passenger or security guards get off a ship at the island where the ship is currently anchored.
  • We move a ship from the island where the ship is currently anchored to the other island where the ship connects.

Since the budget is limited, we can introduce at most QQ new ships. For each kk (0kQ0 ≤ k ≤ Q), Prime minister KK wants to know the minimum possible number of hired security guards if the number of newly introduced ships is kk.

Write a program which, given the information of islands and the routes of the ships and the number of new ships we can introduce, calculates the minimum possible number of hired security guards for each kk.

입력

Read the following data from the standard input.

NN MM QQ

S_1S\_1 S_2S\_2 \cdots S_NS\_N

A_1A\_1 B_1B\_1

A_2A\_2 B_2B\_2

\vdots

A_MA\_M B_MB\_M

출력

Write Q+1Q+1 lines to the standard output. The (k+1)(k+1)-th line (0kQ0 ≤ k ≤ Q) of output should contain the minimum possible number of hired security guards if the number of newly introduced ships is kk.

제한

  • 2N200,0002 ≤ N ≤ 200\\,000.
  • N1M400,000N - 1 ≤ M ≤ 400\\,000.
  • 0Q200,0000 ≤ Q ≤ 200\\,000.
  • 1S_i1091 ≤ S\_i ≤ 10^9 (1iN1 ≤ i ≤ N).
  • 1A_j<B_jN1 ≤ A\_j < B\_j ≤ N (1jM1 ≤ j ≤ M). (A_x,B_x)(A_y,B_y)(A\_x, B\_x) \ne (A\_y, B\_y) (1x<yM1 ≤ x < y ≤ M).
  • It is possible to travel from any island to any other island by taking a number of ships.
  • Given values are all integers.