GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Saturday 14 May 2022

[Solution] Toss a Coin to Your Graph... Codeforces Solution | Codeforces Problem Solution 2022

D. Toss a Coin to Your Graph...
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

One day Masha was walking in the park and found a graph under a tree... Surprised? Did you think that this problem would have some logical and reasoned story? No way! So, the problem...

Solution Click Below:-  CLICK HERE

Masha has an oriented graph which i-th vertex contains some positive integer ai. Initially Masha can put a coin at some vertex. In one operation she can move a coin placed in some vertex u to any other vertex v such that there is an oriented edge uv in the graph. Each time when the coin is placed in some vertex i, Masha write down an integer ai in her notebook (in particular, when Masha initially puts a coin at


 some vertex, she writes an integer written at this vertex in her notebook). Masha wants to make exactly k1 operations in such way that the maximum number written in her notebook is as small as possible.

Input

The first line contains three integers nm and k (1n21050m21051k1018) — the number of vertices and edges in the graph, and the number of operation that Masha should make.

The second line contains n integers ai (1ai109) — the numbers written in graph vertices.

Each of the following m lines contains two integers u and v (1uvn) — it means that there is an edge uv in the graph.

It's guaranteed that graph doesn't contain loops and multi-edges.

Output

Print one integer — the minimum value of the maximum number that Masha wrote in her notebook during optimal coin movements.

If Masha won't be able to perform k1 operations, print 1.

Join Now for Solution:- 

No comments:

Post a Comment