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 |
---|---|---|---|---|---|---|
1088 | Codeforces Round 525 (Div. 2) | FINISHED | False | 7200 | 193591523 | Dec. 4, 2018, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1521 ) | E | Ehab and a component choosing problem | PROGRAMMING | dp greedy math trees | 2400 |
B"You're given a tree consisting of n nodes. Every node u has a weight a_u . You want to choose an integer k (1 <= k <= n) and then choose k connected components of nodes that don't overlap (i.e every node is in at most 1 component). Let the set of nodes you chose be s . You want to maximize: frac{ sum limits_{u in s} a_u}{k} In other words, you want to maximize the sum of weights of nodes in s divided by the number of connected components you chose. Also, if there are several solutions, you want to maximize k . Note that adjacent nodes can belong to different components. Refer to the third sample. The first line contains the integer n (1 <= n <= 3 cdot 10^5) , the number of nodes in the tree. The second line contains n space-separated integers a_1 , a_2 , ... , a_n (|a_i| <= 10^9) , the weights of the nodes. The next n-1 lines, each contains 2 space-separated integers u and v (1 <= u,v <= n) which means there's an edge between u and v . Print the answer as a non-reduced fraction represented by 2 space-separated integers. The fraction itself should be maximized and if there are several possible ways, you should maximize the denominator. See the samples for a better understanding. A connected component is a set of nodes such that for any node in the set, you can reach all other nodes in the set passing only nodes in the set. In the first sample, it's optimal to choose the whole tree. In the second sample, you only have one choice (to choose node 1) because you can't choose 0 components. In the third sample, notice that we could've, for example, chosen only node 1, or node 1 and node 3, or even the whole tree, and the fraction would've had the same value (-1), but we want to maximize k . In the fourth sample, we'll just choose nodes 1 and 3. "... |
Codeforces round #525 editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
57147065 | MRoy | E | July 16, 2019, 1:20 p.m. | OK | GNU C11 | TESTS | 50 | 296 | 32051200 | 2400 | |
48654211 | ReaLNero1 | E | Jan. 21, 2019, 1:24 a.m. | OK | GNU C++11 | TESTS | 50 | 109 | 29491200 | 2400 | |
48712644 | KING_LRL | E | Jan. 22, 2019, 9:23 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 12800000 | 2400 | |
48771337 | luogu_bot1 | E | Jan. 23, 2019, 12:26 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 12800000 | 2400 | |
48716910 | Duanyll | E | Jan. 22, 2019, 11:43 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 15052800 | 2400 | |
46744459 | iamqzh | E | Dec. 8, 2018, 6:01 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 15155200 | 2400 | |
46701272 | xiemiao | E | Dec. 7, 2018, 2:47 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 20787200 | 2400 | |
67057548 | poaspoas | E | Dec. 17, 2019, 7:35 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 23040000 | 2400 | |
46682348 | yjjr | E | Dec. 6, 2018, 12:37 p.m. | OK | GNU C++11 | TESTS | 50 | 124 | 29491200 | 2400 | |
46630316 | Immortal.S | E | Dec. 5, 2018, 2:17 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 38297600 | 2400 | |
48655038 | ReaLNero1 | E | Jan. 21, 2019, 1:59 a.m. | OK | GNU C++11 | TESTS | 50 | 124 | 38297600 | 2400 | |
46630805 | Nostalgically | E | Dec. 5, 2018, 2:52 a.m. | OK | GNU C++14 | TESTS | 50 | 202 | 37785600 | 2400 | |
46614755 | IgorSmirnov | E | Dec. 4, 2018, 4:10 p.m. | OK | GNU C++14 | TESTS | 50 | 218 | 23347200 | 2400 | |
46622000 | tokitsukaze | E | Dec. 4, 2018, 6:35 p.m. | OK | GNU C++14 | TESTS | 50 | 233 | 23347200 | 2400 | |
46632670 | orz010orz | E | Dec. 5, 2018, 4:32 a.m. | OK | GNU C++14 | TESTS | 50 | 234 | 23756800 | 2400 | |
46688333 | DF_cjc | E | Dec. 6, 2018, 3:03 p.m. | OK | GNU C++14 | TESTS | 50 | 264 | 19456000 | 2400 | |
46646268 | cloudsky01 | E | Dec. 5, 2018, 12:03 p.m. | OK | GNU C++14 | TESTS | 50 | 280 | 19456000 | 2400 | |
47021443 | WstOne | E | Dec. 15, 2018, 2:37 a.m. | OK | GNU C++14 | TESTS | 50 | 280 | 20582400 | 2400 | |
52914760 | Bug_Maker | E | April 17, 2019, 3:24 p.m. | OK | GNU C++14 | TESTS | 50 | 280 | 21811200 | 2400 | |
47025089 | LLL_2820 | E | Dec. 15, 2018, 6:21 a.m. | OK | GNU C++14 | TESTS | 50 | 295 | 20582400 | 2400 | |
46648441 | 2010160220 | E | Dec. 5, 2018, 12:54 p.m. | OK | GNU C++14 | TESTS | 50 | 295 | 21811200 | 2400 | |
46664473 | moss3s | E | Dec. 5, 2018, 11:29 p.m. | OK | GNU C++17 | TESTS | 50 | 186 | 50176000 | 2400 | |
46893707 | massimodong | E | Dec. 11, 2018, 7:54 a.m. | OK | GNU C++17 | TESTS | 50 | 233 | 25907200 | 2400 | |
46651418 | Elegia | E | Dec. 5, 2018, 2:13 p.m. | OK | GNU C++17 | TESTS | 50 | 280 | 15667200 | 2400 | |
46677519 | vjudge2 | E | Dec. 6, 2018, 10:35 a.m. | OK | GNU C++17 | TESTS | 50 | 280 | 19456000 | 2400 | |
48658583 | 201530800126 | E | Jan. 21, 2019, 4:41 a.m. | OK | GNU C++17 | TESTS | 50 | 295 | 25907200 | 2400 | |
46631646 | xywsxp | E | Dec. 5, 2018, 3:36 a.m. | OK | GNU C++17 | TESTS | 50 | 311 | 21811200 | 2400 | |
46753833 | Pepcy_Ch | E | Dec. 8, 2018, 10:37 a.m. | OK | GNU C++17 | TESTS | 50 | 312 | 28262400 | 2400 | |
46639897 | qhqh | E | Dec. 5, 2018, 9 a.m. | OK | GNU C++17 | TESTS | 50 | 327 | 19251200 | 2400 | |
46664888 | ivan100sic | E | Dec. 6, 2018, 12:13 a.m. | OK | GNU C++17 | TESTS | 50 | 327 | 20582400 | 2400 | |
65761322 | Magicdog_Jo | E | Nov. 26, 2019, 3:56 p.m. | OK | GNU C++17 | TESTS | 50 | 327 | 23040000 | 2400 | |
46991070 | gksato | E | Dec. 14, 2018, 4:18 a.m. | OK | Haskell | TESTS | 50 | 311 | 78950400 | 2400 | |
46991307 | gksato | E | Dec. 14, 2018, 4:37 a.m. | OK | Haskell | TESTS | 50 | 311 | 83148800 | 2400 | |
47020822 | gksato | E | Dec. 15, 2018, 1:25 a.m. | OK | Haskell | TESTS | 50 | 326 | 83148800 | 2400 | |
47020878 | gksato | E | Dec. 15, 2018, 1:33 a.m. | OK | Haskell | TESTS | 50 | 327 | 83148800 | 2400 | |
46991279 | gksato | E | Dec. 14, 2018, 4:35 a.m. | OK | Haskell | TESTS | 50 | 327 | 85299200 | 2400 | |
46990850 | gksato | E | Dec. 14, 2018, 4 a.m. | OK | Haskell | TESTS | 50 | 342 | 84275200 | 2400 | |
46986312 | gksato | E | Dec. 13, 2018, 8:24 p.m. | OK | Haskell | TESTS | 50 | 343 | 76902400 | 2400 | |
46990896 | gksato | E | Dec. 14, 2018, 4:03 a.m. | OK | Haskell | TESTS | 50 | 343 | 82124800 | 2400 | |
46986426 | gksato | E | Dec. 13, 2018, 8:30 p.m. | OK | Haskell | TESTS | 50 | 358 | 76902400 | 2400 | |
46990992 | gksato | E | Dec. 14, 2018, 4:10 a.m. | OK | Haskell | TESTS | 50 | 358 | 84275200 | 2400 | |
46652074 | aman28rwt | E | Dec. 5, 2018, 2:30 p.m. | OK | Java 8 | TESTS | 50 | 295 | 33894400 | 2400 | |
46652050 | aman28rwt | E | Dec. 5, 2018, 2:29 p.m. | OK | Java 8 | TESTS | 50 | 342 | 33894400 | 2400 | |
47011237 | 7dan | E | Dec. 14, 2018, 4:37 p.m. | OK | Java 8 | TESTS | 50 | 405 | 29081600 | 2400 | |
46990752 | flyman3046 | E | Dec. 14, 2018, 3:50 a.m. | OK | Java 8 | TESTS | 50 | 452 | 43110400 | 2400 | |
48780337 | donli | E | Jan. 23, 2019, 6:33 a.m. | OK | Java 8 | TESTS | 50 | 467 | 15667200 | 2400 | |
46645776 | PrakharJain | E | Dec. 5, 2018, 11:53 a.m. | OK | Java 8 | TESTS | 50 | 748 | 69939200 | 2400 | |
46635511 | omelette | E | Dec. 5, 2018, 6:26 a.m. | OK | Java 8 | TESTS | 50 | 763 | 73932800 | 2400 | |
46642958 | wadissimo | E | Dec. 5, 2018, 10:47 a.m. | OK | Java 8 | TESTS | 50 | 795 | 104038400 | 2400 | |
46731121 | mikkk | E | Dec. 7, 2018, 5:30 p.m. | OK | Java 8 | TESTS | 50 | 951 | 77004800 | 2400 | |
46635297 | habibulka | E | Dec. 5, 2018, 6:17 a.m. | OK | Java 8 | TESTS | 50 | 951 | 80588800 | 2400 | |
48772570 | vjudge1 | E | Jan. 23, 2019, 1:35 a.m. | OK | MS C++ | TESTS | 50 | 233 | 20275200 | 2400 | |
58915175 | vjudge2 | E | Aug. 16, 2019, 2:40 p.m. | OK | MS C++ | TESTS | 50 | 374 | 26419200 | 2400 | |
46756695 | vjudge5 | E | Dec. 8, 2018, 12:06 p.m. | OK | MS C++ | TESTS | 50 | 405 | 23654400 | 2400 | |
46819745 | Bjorneer | E | Dec. 9, 2018, 2:29 p.m. | OK | MS C++ | TESTS | 50 | 873 | 32153600 | 2400 | |
58958803 | vjudge1 | E | Aug. 17, 2019, 2:14 p.m. | OK | MS C++ | TESTS | 50 | 951 | 35635200 | 2400 | |
63930842 | Reyn | E | Oct. 31, 2019, 2:14 p.m. | OK | MS C++ 2017 | TESTS | 50 | 452 | 22220800 | 2400 |
Back to search problems