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'You are a mayor of Berlyatov. There are n districts and m two-way roads between them. The i -th road connects districts x_i and y_i . The cost of travelling along this road is w_i . There is some path between each pair of districts, so the city is connected. There are k delivery routes in Berlyatov. The i -th route is going from the district a_i to the district b_i . There is one courier on each route and the courier will always choose the cheapest (minimum by total cost) path from the district a_i to the district b_i to deliver products. The route can go from the district to itself, some couriers routes can coincide (and you have to count them independently). You can make at most one road to have cost zero (i.e. you choose at most one road and change its cost with 0 ). Let d(x, y) be the cheapest cost of travel between districts x and y . Your task is to find the minimum total courier routes cost you can achieve, if you optimally select the some road and change its cost with 0 . In other words, you have to find the minimum possible value of sum limits_{i = 1}^{k} d(a_i, b_i) after applying the operation described above optimally. The first line of the input contains three integers n , m and k ( 2 <= n <= 1000 ; n - 1 <= m <= min(1000, frac{n(n-1)}{2}) ; 1 <= k <= 1000 ) -- the number of districts, the number of roads and the number of courier routes. The next m lines describe roads. The i -th road is given as three integers x_i , y_i and w_i ( 1 <= x_i, y_i <= n ; x_i ne y_i ; 1 <= w_i <= 1000 ), where x_i and y_i are districts the i -th road connects and w_i is its cost. It is guaranteed that there is some path between each pair of districts, so the city is connected. It is also guaranteed that there is at most one road between each pair of distric'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
96197703 |
tourifeng |
G |
Oct. 21, 2020, 2:43 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
46 |
8192000 |
|
|
96197471 |
tourifeng |
G |
Oct. 21, 2020, 2:37 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
46 |
8192000 |
|
|
96162721 |
Adibov |
G |
Oct. 20, 2020, 4:29 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
61 |
4198400 |
|
|
96170449 |
onlystar |
G |
Oct. 20, 2020, 5:07 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
77 |
4198400 |
|
|
96198150 |
xgcjay |
G |
Oct. 21, 2020, 2:53 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
78 |
4096000 |
|
|
96178151 |
usuyus.22 |
G |
Oct. 20, 2020, 6:25 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
78 |
4096000 |
|
|
96194224 |
fangshaofen |
G |
Oct. 21, 2020, 12:55 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
78 |
16179200 |
|
|
96194001 |
wannaAC |
G |
Oct. 21, 2020, 12:46 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
78 |
16179200 |
|
|
96194796 |
cyh_toby |
G |
Oct. 21, 2020, 1:16 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
93 |
4096000 |
|
|
96193028 |
He_Ren |
G |
Oct. 21, 2020, 12:04 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
93 |
4096000 |
|
|
96198342 |
Rebro |
G |
Oct. 21, 2020, 2:57 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
46 |
4300800 |
|
|
96195299 |
KazamaHoang |
G |
Oct. 21, 2020, 1:33 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
109 |
4403200 |
|
|
96195132 |
VTruongAn |
G |
Oct. 21, 2020, 1:28 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
109 |
4403200 |
|
|
96197544 |
Persephone |
G |
Oct. 21, 2020, 2:39 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
109 |
5324800 |
|
|
96182470 |
apoorv1999 |
G |
Oct. 20, 2020, 7:23 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
124 |
4198400 |
|
|
96170881 |
apoorv1999 |
G |
Oct. 20, 2020, 5:11 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
124 |
4198400 |
|
|
96169567 |
PerfectIdiot |
G |
Oct. 20, 2020, 5 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
124 |
4198400 |
|
|
96202504 |
ash_98 |
G |
Oct. 21, 2020, 4:36 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
124 |
4300800 |
|
|
96202294 |
youarethestupiddog |
G |
Oct. 21, 2020, 4:31 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
124 |
4300800 |
|
|
96200461 |
Cleardream |
G |
Oct. 21, 2020, 3:46 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
124 |
4300800 |
|
|
remove filters
Back to search problems