Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B"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... Masha has an oriented graph which i -th vertex contains some positive integer a_i . 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 u to v in the graph. Each time when the coin is placed in some vertex i , Masha write down an integer a_i 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 k - 1 operations in such way that the maximum number written in her notebook is as small as possible. The first line contains three integers n , m and k ( 1 <= n <= 2 cdot 10^5 , 0 <= m <= 2 cdot 10^5 , 1 <= k <= 10^{18} ) -- the number of vertices and edges in the graph, and the number of operation that Masha should make. The second line contains n integers a_i ( 1 <= a_i <= 10^9 ) -- the numbers written in graph vertices. Each of the following m lines contains two integers u and v ( 1 <= u ne v <= n ) -- it means that there is an edge u to v in the graph. It's guaranteed that graph doesn't contain loops and multi-edges. 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 k - 1 operations, print -1 . Graph described in the first and the second examples is illustrated below. In the first example Masha can initially put a coin at vertex 1 . After that she can perform three operations: 1 to 3 , 3 to 4 and 4 to 5 . Integers 1, 2, 3 and 4 will be written in the notepad"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
157217034 |
Syf2020 |
D |
May 14, 2022, 2:31 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
280 |
8294400 |
|
|
157208386 |
two_lcl |
D |
May 14, 2022, 1:05 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
343 |
56729600 |
|
|
157208634 |
ZY_JK |
D |
May 14, 2022, 1:07 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
374 |
12595200 |
|
|
157209771 |
vuavisao |
D |
May 14, 2022, 1:16 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
420 |
14540800 |
|
|
157262450 |
Commonrain |
D |
May 15, 2022, 5:41 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
436 |
28364800 |
|
|
157205434 |
Krystallos |
D |
May 14, 2022, 12:46 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
452 |
14848000 |
|
|
157261313 |
1287971889 |
D |
May 15, 2022, 5:24 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
467 |
8499200 |
|
|
157261947 |
HaPpY1213 |
D |
May 15, 2022, 5:33 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
468 |
9830400 |
|
|
157225092 |
telesto |
D |
May 14, 2022, 3:45 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
483 |
6860800 |
|
|
157257396 |
aaforce202 |
D |
May 15, 2022, 4:27 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
483 |
7782400 |
|
|
157217352 |
jhc_123 |
D |
May 14, 2022, 2:34 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
233 |
26828800 |
|
|
157217251 |
jhc_123 |
D |
May 14, 2022, 2:33 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
358 |
26828800 |
|
|
157217030 |
jhc_123 |
D |
May 14, 2022, 2:31 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
358 |
26828800 |
|
|
157230682 |
t.alhumaidi |
D |
May 14, 2022, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
436 |
7987200 |
|
|
157238533 |
Snow |
D |
May 14, 2022, 6:21 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
451 |
6963200 |
|
|
157216225 |
Kiana_Go |
D |
May 14, 2022, 2:23 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
452 |
11468800 |
|
|
157207031 |
DimmyT |
D |
May 14, 2022, 12:56 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
468 |
9113600 |
|
|
157254417 |
ug1y-b0y |
D |
May 15, 2022, 3:01 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
468 |
9932800 |
|
|
157195674 |
dgsvygd |
D |
May 14, 2022, 11:23 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
483 |
9318400 |
|
|
157251150 |
fabo3000 |
D |
May 15, 2022, 1:04 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
483 |
10035200 |
|
|
157247377 |
bayashi_cl |
D |
May 14, 2022, 10:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
389 |
25804800 |
|
|
157252480 |
Virtual_Dark |
D |
May 15, 2022, 2:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
467 |
8192000 |
|
|
157252416 |
Virtual_Dark |
D |
May 15, 2022, 2:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
530 |
8192000 |
|
|
157242479 |
TheHavoc |
D |
May 14, 2022, 7:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
608 |
14540800 |
|
|
157196424 |
Haven_ |
D |
May 14, 2022, 11:25 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
655 |
27033600 |
|
|
157198381 |
User_Carrot |
D |
May 14, 2022, 11:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
717 |
13209600 |
|
|
157225550 |
zucc31901019 |
D |
May 14, 2022, 3:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
732 |
20172800 |
|
|
157247667 |
ki0apa |
D |
May 14, 2022, 10:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
763 |
18534400 |
|
|
157253645 |
Rick_GT |
D |
May 15, 2022, 2:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
779 |
11161600 |
|
|
157208146 |
leiruo |
D |
May 14, 2022, 1:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
779 |
14233600 |
|
|
remove filters
Back to search problems