city has man-made intelligence huge loads of black-top. x huge loads of black-top are spent while fixing a street, and to fix a street among I and j, urban communities I and j should have essentially x huge loads of black-top between them. All in all, if city I had simulated intelligence huge loads of black-top and city j had aj tons, there would remain ai+aj−x tons
Correct answer will be upvoted else downvoted.
The I-th city has man-made intelligence huge loads of black-top. x huge loads of black-top are spent while fixing a street, and to fix a street among I and j, urban communities I and j should have essentially x huge loads of black-top between them. All in all, if city I had simulated intelligence huge loads of black-top and city j had aj tons, there would remain
Kindly decide whether it is feasible to associate every one of the urban communities, and assuming this is the case, output any succession of streets to fix.
Input
The principal line contains integers n, m, and x (2≤n≤3⋅105; n−1≤m≤3⋅105; 1≤x≤109) — the number of urban communities, number of streets, and measure of black-top expected to fix one street.
The following line contains n space-isolated integer simulated intelligence (0≤ai≤109) — the measure of black-top at first at city I.
The following m lines contains two integers xi and yi (xi≠yi; 1≤xi,yi≤n) — the urban areas associated by the I-th street. It is ensured that there is all things considered one street between each pair of urban communities, and that the city was initially associated before the seismic tremor.
Output
In case it is unimaginable to expect to associate every one of the urban communities, print NO. In any case, print YES followed by n−1 integers e1,e2,… ,en−1, the request wherein the streets ought to be fixed. ei is the file of the I-th street to fix. In case there are different arrangements, print any.
Step by step
Solved in 3 steps with 1 images