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"Masha lives in a country with n cities numbered from 1 to n . She lives in the city number 1 . There is a direct train route between each pair of distinct cities i and j , where i neq j . In total there are n(n-1) distinct routes. Every route has a cost, cost for route from i to j may be different from the cost of route from j to i . Masha wants to start her journey in city 1 , take exactly k routes from one city to another and as a result return to the city 1 . Masha is really careful with money, so she wants the journey to be as cheap as possible. To do so Masha doesn't mind visiting a city multiple times or even taking the same route multiple times. Masha doesn't want her journey to have odd cycles. Formally, if you can select visited by Masha city v , take odd number of routes used by Masha in her journey and return to the city v , such journey is considered unsuccessful. Help Masha to find the cheapest (with minimal total cost of all taken routes) successful journey. First line of input had two integer numbers n,k ( 2 <= q n <= q 80; 2 <= q k <= q 10 ): number of cities in the country and number of routes in Masha's journey. It is guaranteed that k is even. Next n lines hold route descriptions: j -th number in i -th line represents the cost of route from i to j if i neq j , and is 0 otherwise (there are no routes i to i ). All route costs are integers from 0 to 10^8 . Output a single integer -- total cost of the cheapest Masha's successful journey. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
71953713 |
heavyshower |
D |
Feb. 27, 2020, 6:17 a.m. |
OK |
GNU C++11 |
TESTS |
134 |
218 |
0 |
|
2300 |
71731932 |
BigBag |
D |
Feb. 23, 2020, 8:25 p.m. |
OK |
GNU C++11 |
TESTS |
131 |
296 |
0 |
|
2300 |
71745463 |
Aidos |
D |
Feb. 24, 2020, 5:52 a.m. |
OK |
GNU C++11 |
TESTS |
134 |
311 |
0 |
|
2300 |
71894336 |
huanggs |
D |
Feb. 26, 2020, 4:27 a.m. |
OK |
GNU C++11 |
TESTS |
134 |
373 |
0 |
|
2300 |
71731920 |
BigBag |
D |
Feb. 23, 2020, 8:24 p.m. |
OK |
GNU C++11 |
TESTS |
131 |
530 |
0 |
|
2300 |
71847092 |
woriazzc |
D |
Feb. 25, 2020, 9:35 a.m. |
OK |
GNU C++11 |
TESTS |
134 |
748 |
102400 |
|
2300 |
71871607 |
atoiz |
D |
Feb. 25, 2020, 4:25 p.m. |
OK |
GNU C++11 |
TESTS |
134 |
780 |
7065600 |
|
2300 |
71711337 |
Kamfucius |
D |
Feb. 23, 2020, 4:48 p.m. |
OK |
GNU C++11 |
TESTS |
129 |
826 |
4096000 |
|
2300 |
71764110 |
EMEJ |
D |
Feb. 24, 2020, 12:55 p.m. |
OK |
GNU C++11 |
TESTS |
134 |
873 |
102400 |
|
2300 |
71731884 |
BigBag |
D |
Feb. 23, 2020, 8:24 p.m. |
OK |
GNU C++11 |
TESTS |
131 |
1045 |
0 |
|
2300 |
71731522 |
NVAL |
D |
Feb. 23, 2020, 8:15 p.m. |
OK |
GNU C++14 |
TESTS |
131 |
140 |
0 |
|
2300 |
71731701 |
NVAL |
D |
Feb. 23, 2020, 8:19 p.m. |
OK |
GNU C++14 |
TESTS |
131 |
156 |
102400 |
|
2300 |
71731495 |
NVAL |
D |
Feb. 23, 2020, 8:14 p.m. |
OK |
GNU C++14 |
TESTS |
131 |
296 |
0 |
|
2300 |
71862854 |
BlueDiamond |
D |
Feb. 25, 2020, 2:03 p.m. |
OK |
GNU C++14 |
TESTS |
134 |
420 |
0 |
|
2300 |
71716196 |
step_by_step |
D |
Feb. 23, 2020, 5:17 p.m. |
OK |
GNU C++14 |
TESTS |
129 |
607 |
7168000 |
|
2300 |
71713222 |
Zhukov_Dmitry |
D |
Feb. 23, 2020, 4:59 p.m. |
OK |
GNU C++14 |
TESTS |
129 |
810 |
5529600 |
|
2300 |
71721501 |
Svyat |
D |
Feb. 23, 2020, 5:54 p.m. |
OK |
GNU C++14 |
TESTS |
129 |
826 |
7270400 |
|
2300 |
71904228 |
Koosha_Mv |
D |
Feb. 26, 2020, 9:18 a.m. |
OK |
GNU C++14 |
TESTS |
134 |
998 |
409600 |
|
2300 |
71907212 |
Koosha_Mv |
D |
Feb. 26, 2020, 10:29 a.m. |
OK |
GNU C++14 |
TESTS |
134 |
1029 |
409600 |
|
2300 |
71730615 |
orz |
D |
Feb. 23, 2020, 7:56 p.m. |
OK |
GNU C++14 |
TESTS |
130 |
1044 |
1024000 |
|
2300 |
71733790 |
Flyce |
D |
Feb. 23, 2020, 9:21 p.m. |
OK |
GNU C++17 |
TESTS |
134 |
46 |
512000 |
|
2300 |
71733132 |
Flyce |
D |
Feb. 23, 2020, 9 p.m. |
OK |
GNU C++17 |
TESTS |
134 |
46 |
512000 |
|
2300 |
71829010 |
little_misfortune |
D |
Feb. 25, 2020, 1:20 a.m. |
OK |
GNU C++17 |
TESTS |
134 |
265 |
0 |
|
2300 |
71730272 |
Um_nik |
D |
Feb. 23, 2020, 7:49 p.m. |
OK |
GNU C++17 |
TESTS |
129 |
343 |
102400 |
|
2300 |
71725556 |
SpyCheese |
D |
Feb. 23, 2020, 6:24 p.m. |
OK |
GNU C++17 |
TESTS |
129 |
389 |
4096000 |
|
2300 |
71738418 |
zzxzxzzxz |
D |
Feb. 24, 2020, 1:21 a.m. |
OK |
GNU C++17 |
TESTS |
134 |
390 |
204800 |
|
2300 |
71714120 |
AndreySergunin |
D |
Feb. 23, 2020, 5:05 p.m. |
OK |
GNU C++17 |
TESTS |
129 |
452 |
0 |
|
2300 |
71730470 |
PoDuReM |
D |
Feb. 23, 2020, 7:53 p.m. |
OK |
GNU C++17 |
TESTS |
129 |
483 |
204800 |
|
2300 |
71721768 |
PoDuReM |
D |
Feb. 23, 2020, 5:56 p.m. |
OK |
GNU C++17 |
TESTS |
129 |
483 |
204800 |
|
2300 |
71712718 |
Golovanov399 |
D |
Feb. 23, 2020, 4:56 p.m. |
OK |
GNU C++17 |
TESTS |
129 |
483 |
204800 |
|
2300 |
71714629 |
VArtem |
D |
Feb. 23, 2020, 5:08 p.m. |
OK |
Java 8 |
TESTS |
129 |
1637 |
0 |
|
2300 |
71939066 |
MagentaCobra |
D |
Feb. 26, 2020, 8:44 p.m. |
OK |
Java 8 |
TESTS |
134 |
2433 |
0 |
|
2300 |
71724732 |
mmaxio |
D |
Feb. 23, 2020, 6:18 p.m. |
OK |
Java 8 |
TESTS |
129 |
2635 |
0 |
|
2300 |
71838452 |
ijxjdjd |
D |
Feb. 25, 2020, 6:32 a.m. |
OK |
Java 8 |
TESTS |
134 |
2807 |
0 |
|
2300 |
71736777 |
fetetriste |
D |
Feb. 23, 2020, 11:46 p.m. |
OK |
Java 8 |
TESTS |
134 |
2979 |
0 |
|
2300 |
71831435 |
nk.karpov |
D |
Feb. 25, 2020, 3:05 a.m. |
OK |
Kotlin |
TESTS |
134 |
701 |
1228800 |
|
2300 |
71827188 |
nk.karpov |
D |
Feb. 24, 2020, 11:33 p.m. |
OK |
Kotlin |
TESTS |
134 |
1154 |
1331200 |
|
2300 |
71831475 |
nk.karpov |
D |
Feb. 25, 2020, 3:06 a.m. |
OK |
Kotlin |
TESTS |
134 |
1216 |
1331200 |
|
2300 |
71827022 |
nk.karpov |
D |
Feb. 24, 2020, 11:23 p.m. |
OK |
Kotlin |
TESTS |
134 |
1825 |
1331200 |
|
2300 |
71831549 |
nk.karpov |
D |
Feb. 25, 2020, 3:09 a.m. |
OK |
Kotlin |
TESTS |
134 |
2495 |
1331200 |
|
2300 |
71765120 |
gnomina007 |
D |
Feb. 24, 2020, 1:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
134 |
2386 |
8396800 |
|
2300 |
71764934 |
gnomina007 |
D |
Feb. 24, 2020, 1:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
134 |
2464 |
8396800 |
|
2300 |
remove filters
Back to search problems