Codeforces Round 527 (Div. 3)

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
1092 Codeforces Round 527 (Div. 3) FINISHED False 7200 186679499 Dec. 18, 2018, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8243 ) F Tree with Maximum Cost PROGRAMMING dfs and similar dp trees 2100

B"You are given a tree consisting exactly of n vertices. Tree is a connected undirected graph with n-1 edges. Each vertex v of this tree has a value a_v assigned to it. Let dist(x, y) be the distance between the vertices x and y . The distance between the vertices is the number of edges on the simple path between them. Let's define the cost of the tree as the following value: firstly, let's fix some vertex of the tree. Let it be v . Then the cost of the tree is sum limits_{i = 1}^{n} dist(i, v) cdot a_i . Your task is to calculate the maximum possible cost of the tree if you can choose v arbitrarily. The first line contains one integer n , the number of vertices in the tree ( 1 <= n <= 2 cdot 10^5 ). The second line of the input contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 2 cdot 10^5 ), where a_i is the value of the vertex i . Each of the next n - 1 lines describes an edge of the tree. Edge i is denoted by two integers u_i and v_i , the labels of vertices it connects ( 1 <= u_i, v_i <= n , u_i ne v_i ). It is guaranteed that the given edges form a tree. Print one integer -- the maximum possible cost of the tree if you can choose any vertex as v . Picture corresponding to the first example: You can choose the vertex 3 as a root, then the answer will be 2 cdot 9 + 1 cdot 4 + 0 cdot 1 + 3 cdot 7 + 3 cdot 10 + 4 cdot 1 + 4 cdot 6 + 4 cdot 5 = 18 + 4 + 0 + 21 + 30 + 4 + 24 + 20 = 121 . In the second example tree consists only of one vertex so the answer is always 0 . "...

Tutorials

Codeforces Round #527 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
54956174 Denor F June 1, 2019, 11:16 p.m. OK Delphi TESTS 36 171 20582400 2100
56716211 rainboy F July 8, 2019, 2:45 p.m. OK GNU C11 TESTS 36 155 19968000 2100
47701807 raja_123 F Dec. 29, 2018, 5:13 p.m. OK GNU C11 TESTS 36 218 27443200 2100
61026058 luogu_bot5 F Sept. 21, 2019, 4:01 p.m. OK GNU C++11 TESTS 36 77 11059200 2100
47384475 luogu_bot1 F Dec. 23, 2018, 2:48 a.m. OK GNU C++11 TESTS 36 77 16793600 2100
47889766 Rubbish12345 F Jan. 4, 2019, 5:12 a.m. OK GNU C++11 TESTS 36 78 11161600 2100
47266156 Zechariah_2001 F Dec. 19, 2018, 2:25 p.m. OK GNU C++11 TESTS 36 78 15462400 2100
47228551 Zechariah_2001 F Dec. 18, 2018, 5:09 p.m. OK GNU C++11 TESTS 36 78 15872000 2100
63919989 luogu_bot3 F Oct. 31, 2019, 11:24 a.m. OK GNU C++11 TESTS 36 78 17612800 2100
48654491 ReaLNero1 F Jan. 21, 2019, 1:35 a.m. OK GNU C++11 TESTS 36 78 18124800 2100
47246821 Dilute F Dec. 19, 2018, 6:18 a.m. OK GNU C++11 TESTS 36 78 18432000 2100
64121947 luogu_bot3 F Nov. 3, 2019, 2:03 a.m. OK GNU C++11 TESTS 36 78 19251200 2100
64121899 victor_12369 F Nov. 3, 2019, 2:01 a.m. OK GNU C++11 TESTS 36 78 19251200 2100
47229449 KristinAlter F Dec. 18, 2018, 5:27 p.m. OK GNU C++14 TESTS 36 93 18636800 2100
47229542 KristinAlter F Dec. 18, 2018, 5:29 p.m. OK GNU C++14 TESTS 36 93 23859200 2100
47240899 wleung_bvg F Dec. 19, 2018, 1:32 a.m. OK GNU C++14 TESTS 36 124 21811200 2100
47369554 tokitsukaze F Dec. 22, 2018, 1:27 p.m. OK GNU C++14 TESTS 36 139 25088000 2100
47255291 cupxsr F Dec. 19, 2018, 10:10 a.m. OK GNU C++14 TESTS 36 171 19456000 2100
48112970 ntwbvdbl_oe F Jan. 9, 2019, 10:46 a.m. OK GNU C++14 TESTS 36 171 20172800 2100
56065944 lanran2002 F June 26, 2019, 7:57 a.m. OK GNU C++14 TESTS 36 186 19251200 2100
47284514 StupidTurtle F Dec. 20, 2018, 5:05 a.m. OK GNU C++14 TESTS 36 187 19968000 2100
57253719 vjudge1 F July 18, 2019, 1:22 a.m. OK GNU C++14 TESTS 36 187 20787200 2100
52488587 xiaolongbao F April 8, 2019, 10:34 a.m. OK GNU C++14 TESTS 36 187 22630400 2100
49911795 dy14n3 F Feb. 14, 2019, 2:32 p.m. OK GNU C++17 TESTS 36 62 13209600 2100
47334220 libra9z F Dec. 21, 2018, 2:22 p.m. OK GNU C++17 TESTS 36 140 15462400 2100
61394453 Lezedary_sandwich F Sept. 28, 2019, 12:57 a.m. OK GNU C++17 TESTS 36 155 13516800 2100
47396130 5120160705 F Dec. 23, 2018, 11:18 a.m. OK GNU C++17 TESTS 36 155 21606400 2100
47288023 AiChiMomo F Dec. 20, 2018, 7:27 a.m. OK GNU C++17 TESTS 36 155 23244800 2100
47290978 moss3s F Dec. 20, 2018, 9:11 a.m. OK GNU C++17 TESTS 36 156 56832000 2100
58471042 vjudge2 F Aug. 9, 2019, 12:14 a.m. OK GNU C++17 TESTS 36 171 21606400 2100
47243432 vjudge4 F Dec. 19, 2018, 3:57 a.m. OK GNU C++17 TESTS 36 171 60928000 2100
58413033 vjudge4 F Aug. 7, 2019, 2:53 a.m. OK GNU C++17 TESTS 36 186 17612800 2100
47274224 Dillonh_ F Dec. 19, 2018, 6:22 p.m. OK GNU C++17 TESTS 36 186 19251200 2100
47274311 Omar_Morsi F Dec. 19, 2018, 6:24 p.m. OK Go TESTS 36 249 32051200 2100
47274202 Omar_Morsi F Dec. 19, 2018, 6:21 p.m. OK Go TESTS 36 374 49971200 2100
47242277 2008061626 F Dec. 19, 2018, 2:58 a.m. OK Go TESTS 36 530 85606400 2100
49813941 ricklee666666 F Feb. 12, 2019, 4:05 a.m. OK Go TESTS 36 545 50073600 2100
49814081 ricklee666666 F Feb. 12, 2019, 4:16 a.m. OK Go TESTS 36 545 50073600 2100
47459723 ledinhbao F Dec. 24, 2018, 2:26 p.m. OK Go TESTS 36 607 90112000 2100
49223545 dongy F Jan. 30, 2019, 8:39 p.m. OK Go TESTS 36 1045 113664000 2100
68317382 TheSawan F Jan. 6, 2020, 1:41 p.m. OK Java 11 TESTS 36 763 68300800 2100
69160059 Kimo_Fathy F Jan. 19, 2020, 10:27 p.m. OK Java 11 TESTS 36 763 215756800 2100
47849882 In_The_Name_Of_Love F Jan. 2, 2019, 5:02 p.m. OK Java 8 TESTS 36 218 30617600 2100
47307665 kusomushi F Dec. 20, 2018, 5:43 p.m. OK Java 8 TESTS 36 327 19558400 2100
47258667 wadissimo F Dec. 19, 2018, 11:27 a.m. OK Java 8 TESTS 36 343 34508800 2100
47368656 SevenDeadlySins F Dec. 22, 2018, 12:57 p.m. OK Java 8 TESTS 36 420 23040000 2100
47275771 hiromi_ayase F Dec. 19, 2018, 7:13 p.m. OK Java 8 TESTS 36 420 48128000 2100
47226764 bhautik_77 F Dec. 18, 2018, 4:41 p.m. OK Java 8 TESTS 36 436 117964800 2100
47256347 jenish9599 F Dec. 19, 2018, 10:36 a.m. OK Java 8 TESTS 36 467 65228800 2100
48051000 revanthreddy85 F Jan. 7, 2019, 9:02 a.m. OK Java 8 TESTS 36 499 67686400 2100
47497218 aminul F Dec. 25, 2018, 3:39 p.m. OK Java 8 TESTS 36 514 58982400 2100
50684084 Anirudh25 F March 2, 2019, 12:52 p.m. OK Java 8 TESTS 36 514 60928000 2100
47847439 Anastasiya_Andreevna F Jan. 2, 2019, 3:34 p.m. OK Mono C# TESTS 36 561 45875200 2100
47518299 562908590 F Dec. 26, 2018, 11:25 a.m. OK Mono C# TESTS 36 561 164044800 2100
47305981 omikad F Dec. 20, 2018, 4:44 p.m. OK Mono C# TESTS 36 654 46694400 2100
58864650 vjudge2 F Aug. 15, 2019, 12:54 p.m. OK MS C++ TESTS 36 140 13619200 2100
58955999 vjudge4 F Aug. 17, 2019, 1:02 p.m. OK MS C++ TESTS 36 140 14438400 2100
58859071 vjudge5 F Aug. 15, 2019, 10:48 a.m. OK MS C++ TESTS 36 155 14643200 2100
58853889 vjudge5 F Aug. 15, 2019, 8:32 a.m. OK MS C++ TESTS 36 155 15974400 2100
58853947 vjudge4 F Aug. 15, 2019, 8:33 a.m. OK MS C++ TESTS 36 155 15974400 2100
58850868 vjudge2 F Aug. 15, 2019, 7:27 a.m. OK MS C++ TESTS 36 155 18432000 2100
58854984 vjudge4 F Aug. 15, 2019, 8:57 a.m. OK MS C++ TESTS 36 155 18636800 2100
58853679 vjudge1 F Aug. 15, 2019, 8:27 a.m. OK MS C++ TESTS 36 155 21606400 2100
58865258 vjudge1 F Aug. 15, 2019, 1:08 p.m. OK MS C++ TESTS 36 156 15155200 2100
57266999 vjudge2 F July 18, 2019, 7:31 a.m. OK MS C++ TESTS 36 156 15257600 2100
56549098 petko_mitkov F July 5, 2019, 8:54 a.m. OK MS C++ 2017 TESTS 36 358 19251200 2100
69507132 mr_smith F Jan. 25, 2020, 9:05 a.m. OK MS C++ 2017 TESTS 36 373 22425600 2100
49559132 Gladius_Smerch F Feb. 7, 2019, 11:36 a.m. OK MS C++ 2017 TESTS 36 623 27340800 2100
50790400 gatsko F March 4, 2019, 3:25 p.m. OK PyPy 2 TESTS 36 967 83046400 2100
47267071 Sushant00 F Dec. 19, 2018, 2:48 p.m. OK Python 3 TESTS 36 1512 42700800 2100
47395177 sy_chen F Dec. 23, 2018, 10:44 a.m. OK Python 3 TESTS 36 1996 209305600 2100
63530794 sansen F Oct. 27, 2019, 6:40 a.m. OK Rust TESTS 36 155 21401600 2100
68297694 sansen F Jan. 6, 2020, 4:18 a.m. OK Rust TESTS 36 186 28467200 2100
68360539 sansen F Jan. 7, 2020, 1:55 p.m. OK Rust TESTS 36 218 32460800 2100

remove filters

Back to search problems