Codeforces Round 254 (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
444 Codeforces Round 254 (Div. 1) FINISHED False 7200 327171299 July 6, 2014, 1:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 777 ) E DZY Loves Planting PROGRAMMING binary search ds trees 2600

B'DZY loves planting, and he enjoys solving tree problems. DZY has a weighted tree (connected undirected graph without cycles) containing n nodes (they are numbered from 1 to n). He defines the function g(x, xe2 x80 x89y) (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x, xe2 x80 x89y xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) as the longest edge in the shortest path between nodes x and y. Specially g(z, xe2 x80 x89z) xe2 x80 x89= xe2 x80 x890 for every z. For every integer sequence p1, xe2 x80 x89p2, xe2 x80 x89..., xe2 x80 x89pn (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89pi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n), DZY defines f(p) as . DZY wants to find such a sequence p that f(p) has maximum possible value. But there is one more restriction: the element j can appear in p at most xj times. Please, find the maximum possible f(p) under the described restrictions. The first line contains an integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893000). Each of the next n xe2 x80 x89- xe2 x80 x891 lines contains three integers ai, xe2 x80 x89bi, xe2 x80 x89ci (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n; 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8910000), denoting an edge between ai and bi with length ci. It is guaranteed that these edges form a tree. Each of the next n lines describes an element of sequence x. The j-th line contains an integer xj (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89xj xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). Print a single integer representing the answer. In the first sample, one of the optimal p is [4, xe2 x80 x893, xe2 x80 x892, xe2 x80 x891].'...

Tutorials

Codeforces Round #254 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
10830298 ljz E April 23, 2015, 3:06 a.m. OK FPC TESTS 49 30 1740800 2600
7033197 Alex_2oo8 E July 6, 2014, 3:41 p.m. OK FPC TESTS 49 62 409600 2600
16200217 SanSiroWaltz E Feb. 19, 2016, 12:46 p.m. OK GNU C++ TESTS 49 15 0 2600
16079883 Gintoki E Feb. 17, 2016, 2:05 p.m. OK GNU C++ TESTS 49 15 0 2600
16079876 vjtest E Feb. 17, 2016, 2:05 p.m. OK GNU C++ TESTS 49 15 0 2600
16079866 bnuvjudge2 E Feb. 17, 2016, 2:04 p.m. OK GNU C++ TESTS 49 15 0 2600
16029214 vjtest E Feb. 15, 2016, 8:34 a.m. OK GNU C++ TESTS 49 15 0 2600
16029194 vjudge5 E Feb. 15, 2016, 8:33 a.m. OK GNU C++ TESTS 49 15 0 2600
15949841 vjtest E Feb. 11, 2016, 3:29 a.m. OK GNU C++ TESTS 49 15 0 2600
7570754 Valaky E Aug. 25, 2014, 6:06 a.m. OK GNU C++ TESTS 49 15 0 2600
13999414 130705009 E Nov. 1, 2015, 3:52 a.m. OK GNU C++ TESTS 49 15 0 2600
27446548 vjudge3 E May 30, 2017, 11 a.m. OK GNU C++ TESTS 49 15 0 2600
7302233 step5 E July 31, 2014, 7:58 p.m. OK GNU C++0x TESTS 49 15 102400 2600
7072712 bill125 E July 13, 2014, 7:30 a.m. OK GNU C++0x TESTS 49 15 102400 2600
7043339 zerokugi E July 7, 2014, 10:03 p.m. OK GNU C++0x TESTS 49 15 102400 2600
7198498 MinakoKojima E July 22, 2014, 12:23 a.m. OK GNU C++0x TESTS 49 15 204800 2600
7285775 yutaka1999 E July 29, 2014, 2:22 p.m. OK GNU C++0x TESTS 49 15 307200 2600
7095038 Zuza E July 13, 2014, 11:19 p.m. OK GNU C++0x TESTS 49 15 307200 2600
7296328 hogloid E July 31, 2014, 2:42 a.m. OK GNU C++0x TESTS 49 15 409600 2600
7030433 Gullesnuffs E July 6, 2014, 2:39 p.m. OK GNU C++0x TESTS 49 15 409600 2600
7035379 Arterm E July 6, 2014, 8:39 p.m. OK GNU C++0x TESTS 49 15 512000 2600
7978635 Swistakk E Sept. 27, 2014, 1:37 a.m. OK GNU C++0x TESTS 49 15 716800 2600
20725561 wwyyxx E Sept. 18, 2016, 5:47 a.m. OK GNU C++11 TESTS 49 15 0 2600
15949834 h10 E Feb. 11, 2016, 3:28 a.m. OK GNU C++11 TESTS 49 15 0 2600
14214740 stefanzzz E Nov. 12, 2015, 1:39 p.m. OK GNU C++11 TESTS 49 15 0 2600
20351856 _Saitama_ E Sept. 3, 2016, 3:11 a.m. OK GNU C++11 TESTS 49 15 102400 2600
14433774 Quang E Nov. 24, 2015, 12:49 a.m. OK GNU C++11 TESTS 49 15 102400 2600
21229734 la1la1la E Oct. 6, 2016, 8:41 a.m. OK GNU C++11 TESTS 49 15 204800 2600
20812708 hnuRoshan E Sept. 22, 2016, 8:26 a.m. OK GNU C++11 TESTS 49 15 204800 2600
18776552 khsoo01 E June 29, 2016, 2:48 a.m. OK GNU C++11 TESTS 49 15 307200 2600
21888281 Yukine_Chris E Oct. 30, 2016, 7:44 a.m. OK GNU C++11 TESTS 49 15 921600 2600
28182462 zhan8855 E July 1, 2017, 2:10 a.m. OK GNU C++11 TESTS 49 15 2048000 2600
27830170 Yousef_Salama E June 16, 2017, 5:10 p.m. OK GNU C++14 TESTS 49 15 409600 2600
20298265 radoslav11 E Aug. 31, 2016, 9:58 a.m. OK GNU C++14 TESTS 49 15 409600 2600
25406419 abeker E March 11, 2017, 1:25 p.m. OK GNU C++14 TESTS 49 15 1945600 2600
23532174 Ali.Pi E Jan. 4, 2017, 9:29 a.m. OK GNU C++14 TESTS 49 15 1945600 2600
35793786 Dalgerok E Feb. 28, 2018, 6:36 p.m. OK GNU C++14 TESTS 49 15 2252800 2600
35793779 Dalgerok E Feb. 28, 2018, 6:36 p.m. OK GNU C++14 TESTS 49 15 2252800 2600
36892764 vjudge1 E April 3, 2018, 4:27 a.m. OK GNU C++14 TESTS 49 15 3788800 2600
54725464 vjudge1 E May 27, 2019, 8:08 p.m. OK GNU C++14 TESTS 49 30 409600 2600
24090064 creatnx E Jan. 24, 2017, 11:23 a.m. OK GNU C++14 TESTS 49 30 2048000 2600
36746950 foreverpiano E March 30, 2018, 12:44 p.m. OK GNU C++14 TESTS 49 30 14233600 2600
62051924 hjk1030 E Oct. 7, 2019, 9:43 a.m. OK GNU C++17 TESTS 49 30 102400 2600
47624532 AliShahali1382 E Dec. 28, 2018, 2:25 p.m. OK GNU C++17 TESTS 49 30 2457600 2600
67059486 Mahdi_Shokoufi E Dec. 17, 2019, 8:27 a.m. OK GNU C++17 TESTS 49 31 102400 2600
63560058 saketh E Oct. 27, 2019, 1:59 p.m. OK GNU C++17 TESTS 49 31 102400 2600
59124393 ruo E Aug. 20, 2019, 7:53 a.m. OK GNU C++17 TESTS 49 31 102400 2600
54737771 vjudge5 E May 28, 2019, 6:03 a.m. OK GNU C++17 TESTS 49 31 102400 2600
46660742 eisen_shinzou E Dec. 5, 2018, 7:08 p.m. OK GNU C++17 TESTS 49 31 102400 2600
66185915 Alireza_Keshavarz E Dec. 2, 2019, 2:29 p.m. OK GNU C++17 TESTS 49 31 204800 2600
46987803 Vahm E Dec. 13, 2018, 10:15 p.m. OK GNU C++17 TESTS 49 31 204800 2600
54728924 ArshiaDadras E May 27, 2019, 9:24 p.m. OK GNU C++17 TESTS 49 31 409600 2600
9816368 trunghieu1191 E Feb. 13, 2015, 1:27 p.m. OK Java 7 TESTS 49 93 0 2600
7030035 qwerty787788 E July 6, 2014, 2:32 p.m. OK Java 7 TESTS 49 218 204800 2600
7216612 owenomar E July 24, 2014, 12:54 p.m. OK Java 7 TESTS 49 233 307200 2600
7053157 uwi E July 9, 2014, 12:32 p.m. OK Java 7 TESTS 49 561 3481600 2600
7030345 Egor E July 6, 2014, 2:37 p.m. OK Java 8 TESTS 49 187 409600 2600
7055428 IgorKoval E July 9, 2014, 10:39 p.m. OK Java 8 TESTS 49 249 2150400 2600
7055423 IgorKoval E July 9, 2014, 10:34 p.m. OK Java 8 TESTS 49 701 4710400 2600
7036608 ainta E July 7, 2014, 2 a.m. OK MS C++ TESTS 49 15 102400 2600
7112177 Rivx E July 15, 2014, 11:05 p.m. OK MS C++ TESTS 49 31 102400 2600
7030939 SergeyRogulenko E July 6, 2014, 2:47 p.m. OK MS C++ TESTS 49 78 204800 2600
7152836 kolina E July 19, 2014, 12:47 a.m. OK MS C++ TESTS 49 280 9011200 2600
7188087 Darooha E July 20, 2014, 4:43 p.m. OK Ocaml TESTS 49 30 307200 2600
51735454 .I. E March 23, 2019, 1:56 a.m. OK Python 3 TESTS 49 171 716800 2600

remove filters

Back to search problems