Codeforces Round 526 (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
1083 Codeforces Round 526 (Div. 1) FINISHED False 7200 193065923 Dec. 10, 2018, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5559 ) A The Fair Nut and the Best Path PROGRAMMING data structures dp trees 1800

B"The Fair Nut is going to travel to the Tree Country, in which there are n cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent a car in the city u and go by a simple path to city v . He hasn't determined the path, so it's time to do it. Note that chosen path can consist of only one vertex. A filling station is located in every city. Because of strange law, Nut can buy only w_i liters of gasoline in the i -th city. We can assume, that he has infinite money. Each road has a length, and as soon as Nut drives through this road, the amount of gasoline decreases by length. Of course, Nut can't choose a path, which consists of roads, where he runs out of gasoline. He can buy gasoline in every visited city, even in the first and the last. He also wants to find the maximum amount of gasoline that he can have at the end of the path. Help him: count it. The first line contains a single integer n ( 1 <= q n <= q 3 cdot 10^5 ) -- the number of cities. The second line contains n integers w_1, w_2, ldots, w_n ( 0 <= q w_{i} <= q 10^9 ) -- the maximum amounts of liters of gasoline that Nut can buy in cities. Each of the next n - 1 lines describes road and contains three integers u , v , c ( 1 <= q u, v <= q n , 1 <= q c <= q 10^9 , u ne v ), where u and v -- cities that are connected by this road and c -- its length. It is guaranteed that graph of road connectivity is a tree. Print one number -- the maximum amount of gasoline that he can have at the end of the path. The optimal way in the first example is 2 to 1 to 3 . The optimal way in the second example is 2 to 4 . "...

Tutorials

63753

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
64722135 luogu_bot5 A Nov. 12, 2019, 4:26 a.m. OK FPC TESTS 53 405 38400000 1800
50264272 jbj2002 A Feb. 21, 2019, 3:25 a.m. OK GNU C++11 TESTS 53 93 35840000 1800
46886608 ErkkiErkko A Dec. 11, 2018, 1:25 a.m. OK GNU C++11 TESTS 53 93 35840000 1800
48655261 ReaLNero1 A Jan. 21, 2019, 2:09 a.m. OK GNU C++11 TESTS 53 108 27443200 1800
47827003 fwat A Jan. 2, 2019, 1:12 a.m. OK GNU C++11 TESTS 53 108 27443200 1800
66581446 yinghua1314 A Dec. 10, 2019, 9:33 a.m. OK GNU C++11 TESTS 53 109 19456000 1800
50264291 luogu_bot4 A Feb. 21, 2019, 3:26 a.m. OK GNU C++11 TESTS 53 109 35840000 1800
66582946 yinghua1314 A Dec. 10, 2019, 10:06 a.m. OK GNU C++11 TESTS 53 124 19456000 1800
59256437 luogu_bot1 A Aug. 22, 2019, 6:53 a.m. OK GNU C++11 TESTS 53 124 22118400 1800
48048054 _zay A Jan. 7, 2019, 6:06 a.m. OK GNU C++11 TESTS 53 124 31846400 1800
47370345 Blue233333 A Dec. 22, 2018, 1:55 p.m. OK GNU C++11 TESTS 53 124 33280000 1800
46904937 vjudge5 A Dec. 11, 2018, 1:45 p.m. OK GNU C++14 TESTS 53 155 84889600 1800
46952830 wleung_bvg A Dec. 12, 2018, 10:44 p.m. OK GNU C++14 TESTS 53 218 40243200 1800
49296485 davidberard A Jan. 31, 2019, 11:25 p.m. OK GNU C++14 TESTS 53 233 39116800 1800
46860274 Linkus A Dec. 10, 2018, 4:47 p.m. OK GNU C++14 TESTS 53 233 57651200 1800
53943550 vjudge3 A May 10, 2019, 5:03 a.m. OK GNU C++14 TESTS 53 280 18534400 1800
61534575 HouZAJ A Sept. 30, 2019, 5:38 a.m. OK GNU C++14 TESTS 53 296 18534400 1800
58647269 vjudge5 A Aug. 12, 2019, 6:17 a.m. OK GNU C++14 TESTS 53 311 33484800 1800
46891508 bibibibi A Dec. 11, 2018, 6:26 a.m. OK GNU C++14 TESTS 53 311 34611200 1800
47817804 I_love_simplespy A Jan. 1, 2019, 3:35 p.m. OK GNU C++14 TESTS 53 311 35020800 1800
50079234 mayaohua2003 A Feb. 18, 2019, 2:12 a.m. OK GNU C++14 TESTS 53 311 35840000 1800
62204446 disposrestfuIly A Oct. 9, 2019, 12:51 p.m. OK GNU C++17 TESTS 53 155 44236800 1800
46922513 Gromah A Dec. 12, 2018, 6:10 a.m. OK GNU C++17 TESTS 53 280 28672000 1800
49217574 .tx A Jan. 30, 2019, 5:44 p.m. OK GNU C++17 TESTS 53 280 67276800 1800
46930681 vjudge5 A Dec. 12, 2018, 11:29 a.m. OK GNU C++17 TESTS 53 296 32256000 1800
46932102 sys. A Dec. 12, 2018, 12:08 p.m. OK GNU C++17 TESTS 53 296 35840000 1800
50928081 xyw5vplus1 A March 7, 2019, 12:46 p.m. OK GNU C++17 TESTS 53 311 33382400 1800
46860412 nimphy A Dec. 10, 2018, 4:47 p.m. OK GNU C++17 TESTS 53 327 51814400 1800
47490360 stArliGht A Dec. 25, 2018, 11:44 a.m. OK GNU C++17 TESTS 53 342 44236800 1800
67021488 Diorvh A Dec. 16, 2019, 1:05 p.m. OK GNU C++17 TESTS 53 342 46284800 1800
47490558 vjudge2 A Dec. 25, 2018, 11:51 a.m. OK GNU C++17 TESTS 53 343 25395200 1800
46860011 Egor A Dec. 10, 2018, 4:46 p.m. OK Java 8 TESTS 53 358 64102400 1800
46865822 uwi A Dec. 10, 2018, 5:10 p.m. OK Java 8 TESTS 53 545 49254400 1800
46884868 kessido A Dec. 10, 2018, 10:25 p.m. OK Java 8 TESTS 53 685 85196800 1800
47598569 Ahmad A Dec. 27, 2018, 8:09 p.m. OK Java 8 TESTS 53 732 132096000 1800
49934463 kusomushi A Feb. 15, 2019, 6:33 a.m. OK Java 8 TESTS 53 794 62873600 1800
59994978 ajkdrag A Sept. 4, 2019, 9:47 a.m. OK Java 8 TESTS 53 795 169881600 1800
53309387 Suzukaze A April 26, 2019, 5:27 a.m. OK Java 8 TESTS 53 904 83251200 1800
46881439 PrakharJain A Dec. 10, 2018, 7:39 p.m. OK Java 8 TESTS 53 904 160256000 1800
49809824 Ziklon A Feb. 11, 2019, 11:08 p.m. OK Java 8 TESTS 53 935 183296000 1800
47318822 Noureldin A Dec. 21, 2018, 6:21 a.m. OK Java 8 TESTS 53 1029 112537600 1800
46864397 elizarov A Dec. 10, 2018, 5:04 p.m. OK Kotlin TESTS 53 1746 94208000 1800
46863412 TERESO A Dec. 10, 2018, 5 p.m. OK Mono C# TESTS 53 1045 143462400 1800
49193884 vjudge2 A Jan. 30, 2019, 9:27 a.m. OK MS C++ TESTS 53 217 43315200 1800
53290772 scorpiowf A April 25, 2019, 3:34 p.m. OK MS C++ TESTS 53 233 31436800 1800
49544325 r57shell A Feb. 6, 2019, 8:40 p.m. OK MS C++ TESTS 53 311 41881600 1800
49191526 vjudge4 A Jan. 30, 2019, 8:26 a.m. OK MS C++ TESTS 53 327 35123200 1800
49198523 vjudge1 A Jan. 30, 2019, 11:32 a.m. OK MS C++ TESTS 53 327 40755200 1800
49195430 vjudge4 A Jan. 30, 2019, 10:12 a.m. OK MS C++ TESTS 53 327 42496000 1800
49201331 vjudge2 A Jan. 30, 2019, 12:31 p.m. OK MS C++ TESTS 53 358 32665600 1800
49191605 vjudge1 A Jan. 30, 2019, 8:28 a.m. OK MS C++ TESTS 53 358 33587200 1800
49198562 vjudge5 A Jan. 30, 2019, 11:33 a.m. OK MS C++ TESTS 53 358 43417600 1800
49197108 vjudge4 A Jan. 30, 2019, 10:57 a.m. OK MS C++ TESTS 53 373 34816000 1800
52631845 AleksanderBalobanov A April 12, 2019, 7:34 a.m. OK MS C++ 2017 TESTS 53 514 54374400 1800
62365010 vjudge3 A Oct. 11, 2019, 1:34 p.m. OK PyPy 3 TESTS 53 2916 179712000 1800
51935743 kobae964 A March 28, 2019, 12:25 p.m. OK Rust TESTS 53 842 68812800 1800

remove filters

Back to search problems