Codeforces Round 485 (Div. 1)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
986 Codeforces Round 485 (Div. 1) FINISHED False 7800 204215099 May 29, 2018, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7009 ) A Fair PROGRAMMING graphs greedy number theory shortest paths 1600

B"Some company is going to hold a fair in Byteland. There are n towns in Byteland and m two-way roads between towns. Of course, you can reach any town from any other town using roads. There are k types of goods produced in Byteland and every town produces only one type. To hold a fair you have to bring at least s different types of goods. It costs d(u,v) coins to bring goods from town u to town v where d(u,v) is the length of the shortest path from u to v . Length of a path is the number of roads in this path. The organizers will cover all travel expenses but they can choose the towns to bring goods from. Now they want to calculate minimum expenses to hold a fair in each of n towns. There are 4 integers n , m , k , s in the first line of input ( 1 <= n <= 10^{5} , 0 <= m <= 10^{5} , 1 <= s <= k <= min(n, 100) ) -- the number of towns, the number of roads, the number of different types of goods, the number of different types of goods necessary to hold a fair. In the next line there are n integers a_1, a_2, ldots, a_n ( 1 <= a_{i} <= k ), where a_i is the type of goods produced in the i -th town. It is guaranteed that all integers between 1 and k occur at least once among integers a_{i} . In the next m lines roads are described. Each road is described by two integers u v ( 1 <= u, v <= n , u ne v ) -- the towns connected by this road. It is guaranteed that there is no more than one road between every two towns. It is guaranteed that you can go from any town to any other town via roads. Print n numbers, the i -th of them is the minimum number of coins you need to spend on travel expenses to hold a fair in town i . Separate numbers with spaces. Let's look at the first sample. To hold a fair in town 1 you can bring goods from towns 1 ( 0 co"...

Tutorials

Codeforces Round #485 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
38730423 Gassa A May 29, 2018, 3:58 p.m. OK D TESTS 21 810 124108800 1600
69618049 hos.lyric A Jan. 27, 2020, 1:46 p.m. OK D TESTS 21 1341 74956800 1600
38753832 avm A May 29, 2018, 11:17 p.m. OK D TESTS 21 1434 73011200 1600
38733055 avm A May 29, 2018, 4:06 p.m. OK D TESTS 21 1669 73011200 1600
41150298 JZYshuraK A Aug. 3, 2018, 8:31 a.m. OK GNU C++ TESTS 21 576 45363200 1600
40028513 luogu_bot1 A July 6, 2018, 11:34 a.m. OK GNU C++ TESTS 21 577 54579200 1600
39352778 diaosipan A June 18, 2018, 9:58 a.m. OK GNU C++ TESTS 21 592 45260800 1600
39689679 e_e A June 27, 2018, 3:05 a.m. OK GNU C++ TESTS 21 608 48947200 1600
38728396 Atlantis592 A May 29, 2018, 3:52 p.m. OK GNU C++ TESTS 21 608 50073600 1600
38730900 kasumi_utako A May 29, 2018, 3:59 p.m. OK GNU C++ TESTS 21 624 51507200 1600
38726410 YES_RPG A May 29, 2018, 3:47 p.m. OK GNU C++ TESTS 21 639 56422400 1600
38755546 Scut82 A May 30, 2018, 1:16 a.m. OK GNU C++ TESTS 21 654 49766400 1600
40029257 Sleepp A July 6, 2018, 12:03 p.m. OK GNU C++ TESTS 21 655 43827200 1600
39701522 linners A June 27, 2018, 12:35 p.m. OK GNU C++ TESTS 21 655 45260800 1600
39203488 orailly A June 13, 2018, 12:52 a.m. OK GNU C11 TESTS 21 997 3993600 1600
39203785 orailly A June 13, 2018, 1:18 a.m. OK GNU C11 TESTS 21 1512 3379200 1600
40932052 ReaLNero1 A July 30, 2018, 1:32 a.m. OK GNU C++11 TESTS 21 483 45772800 1600
38728715 negiizhao A May 29, 2018, 3:53 p.m. OK GNU C++11 TESTS 21 499 48640000 1600
56604829 vjudge1 A July 6, 2019, 3:41 a.m. OK GNU C++11 TESTS 21 529 2867200 1600
61186882 Gimape07 A Sept. 23, 2019, 11:34 p.m. OK GNU C++11 TESTS 21 529 54272000 1600
39533897 ljt12138 A June 23, 2018, 6:38 a.m. OK GNU C++11 TESTS 21 576 46080000 1600
56604827 vjudge2 A July 6, 2019, 3:41 a.m. OK GNU C++11 TESTS 21 577 2867200 1600
46835530 Heaplax A Dec. 10, 2018, 1:44 a.m. OK GNU C++11 TESTS 21 577 43315200 1600
38732546 zhenGG A May 29, 2018, 4:04 p.m. OK GNU C++11 TESTS 21 577 50790400 1600
38759005 vjudge3 A May 30, 2018, 4:23 a.m. OK GNU C++11 TESTS 21 592 49152000 1600
39965570 Ghost0fSparta A July 4, 2018, 7:33 p.m. OK GNU C++11 TESTS 21 592 126054400 1600
38775987 zimpha A May 30, 2018, 2:11 p.m. OK GNU C++14 TESTS 21 529 66969600 1600
38757257 Marco_L_T A May 30, 2018, 2:55 a.m. OK GNU C++14 TESTS 21 545 67481600 1600
60406052 soimportant A Sept. 11, 2019, 6:42 p.m. OK GNU C++14 TESTS 21 561 46899200 1600
53190182 Psychedelic A April 23, 2019, 12:29 p.m. OK GNU C++14 TESTS 21 577 47308800 1600
39259204 yls1170568156 A June 15, 2018, 6:44 a.m. OK GNU C++14 TESTS 21 577 49254400 1600
42590690 sagarstorm A Sept. 6, 2018, 7:50 p.m. OK GNU C++14 TESTS 21 592 64921600 1600
56964058 ShivyShiv A July 13, 2019, 7:44 a.m. OK GNU C++14 TESTS 21 623 126156800 1600
38825738 psdudeman39 A June 1, 2018, 11:08 a.m. OK GNU C++14 TESTS 21 623 130764800 1600
51544572 I-Love-Islam A March 19, 2019, 7:37 p.m. OK GNU C++14 TESTS 21 624 46899200 1600
39501327 fsouza A June 21, 2018, 9:39 p.m. OK GNU C++14 TESTS 21 639 44339200 1600
39290626 voidmax A June 16, 2018, 3:16 p.m. OK GNU C++17 TESTS 21 514 68096000 1600
58262369 vjudge3 A Aug. 4, 2019, 12:53 p.m. OK GNU C++17 TESTS 21 560 49254400 1600
58261854 vjudge5 A Aug. 4, 2019, 12:39 p.m. OK GNU C++17 TESTS 21 561 49356800 1600
38725264 yosupo A May 29, 2018, 3:45 p.m. OK GNU C++17 TESTS 21 608 44953600 1600
52586742 Cadenza A April 11, 2019, 1 a.m. OK GNU C++17 TESTS 21 608 46899200 1600
38724996 voidmax A May 29, 2018, 3:44 p.m. OK GNU C++17 TESTS 21 623 67686400 1600
54794695 Four_Aces A May 29, 2019, 9:02 a.m. OK GNU C++17 TESTS 21 670 45977600 1600
52368587 ronaldo A April 6, 2019, 4:27 a.m. OK GNU C++17 TESTS 21 670 48025600 1600
38725133 abc473848880 A May 29, 2018, 3:44 p.m. OK GNU C++17 TESTS 21 670 50688000 1600
56701767 code_tamer A July 8, 2019, 9:25 a.m. OK GNU C++17 TESTS 21 685 126156800 1600
38984211 megaspazz A June 6, 2018, 5:30 a.m. OK Go TESTS 21 1341 243404800 1600
38808458 sudo_pacman A May 31, 2018, 4:37 p.m. OK Go TESTS 21 1700 141516800 1600
38808591 sudo_pacman A May 31, 2018, 4:43 p.m. OK Go TESTS 21 1730 141516800 1600
38807233 sudo_pacman A May 31, 2018, 3:53 p.m. OK Go TESTS 21 1950 153702400 1600
38807726 sudo_pacman A May 31, 2018, 4:10 p.m. OK Go TESTS 21 1996 148172800 1600
38723482 mmaxio A May 29, 2018, 3:41 p.m. OK Java 8 TESTS 21 888 71372800 1600
38726354 fetetriste A May 29, 2018, 3:47 p.m. OK Java 8 TESTS 21 920 56524800 1600
38777276 ambikeshjha A May 30, 2018, 2:56 p.m. OK Java 8 TESTS 21 935 57139200 1600
38737262 Hohol A May 29, 2018, 4:21 p.m. OK Java 8 TESTS 21 1122 75980800 1600
38808805 ayushchaurasia2879 A May 31, 2018, 4:51 p.m. OK Java 8 TESTS 21 1138 85606400 1600
41137287 Cepera A Aug. 2, 2018, 10:18 p.m. OK Java 8 TESTS 21 1169 65331200 1600
38740688 DicksOut4Harambe A May 29, 2018, 4:36 p.m. OK Java 8 TESTS 21 1247 153497600 1600
38810579 Slamur A May 31, 2018, 6:08 p.m. OK Java 8 TESTS 21 1278 184729600 1600
61858500 TheSawan A Oct. 4, 2019, 2:41 p.m. OK Java 8 TESTS 21 1294 77516800 1600
69831258 lansergecs A Jan. 30, 2020, 10:32 a.m. OK Java 8 TESTS 21 1325 56729600 1600
38736671 elizarov A May 29, 2018, 4:18 p.m. OK Kotlin TESTS 21 1777 77004800 1600
58265601 og.kostya A Aug. 4, 2019, 2:22 p.m. OK Mono C# TESTS 21 1325 69222400 1600
42021983 Jarazorg A Aug. 24, 2018, 9:44 a.m. OK Mono C# TESTS 21 1638 71168000 1600
38725573 wa1tz719 A May 29, 2018, 3:45 p.m. OK MS C++ TESTS 21 701 48742400 1600
48596699 vjudge5 A Jan. 20, 2019, 6:33 a.m. OK MS C++ TESTS 21 1076 48128000 1600
40026047 vjudge3 A July 6, 2018, 9:47 a.m. OK MS C++ TESTS 21 1107 47820800 1600
40459377 vjudge1 A July 17, 2018, 2:53 a.m. OK MS C++ TESTS 21 1122 49459200 1600
51224997 vjudge4 A March 12, 2019, 1:47 p.m. OK MS C++ TESTS 21 1138 222822400 1600
39277996 j4357j A June 16, 2018, 3:15 a.m. OK MS C++ TESTS 21 1185 87552000 1600
38730345 mshcherba A May 29, 2018, 3:58 p.m. OK MS C++ TESTS 21 1232 50176000 1600
57126025 vjudge5 A July 16, 2019, 4:27 a.m. OK MS C++ TESTS 21 1263 460902400 1600
38754924 Los_Angelos_Laycurse A May 30, 2018, 12:36 a.m. OK MS C++ TESTS 21 1294 87347200 1600
41145669 vjudge4 A Aug. 3, 2018, 6:26 a.m. OK MS C++ TESTS 21 1388 45568000 1600
63660974 vjudge1 A Oct. 28, 2019, 2:02 p.m. OK MS C++ 2017 TESTS 21 810 46796800 1600
39283067 vamsi1281977 A June 16, 2018, 9:04 a.m. OK Rust TESTS 21 1122 61440000 1600

remove filters

Back to search problems