Codeforces Round 848 (Div. 2)

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
1778 Codeforces Round 848 (Div. 2) FINISHED False 7200 61917863 Feb. 1, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 700 ) F Maximizing Root PROGRAMMING dfs and similar dp graphs math trees

B'You are given a rooted tree consisting of n vertices numbered from 1 to n . Vertex 1 is the root of the tree. Each vertex has an integer value. The value of i -th vertex is a_i . You can do the following operation at most k times. What is the maximum possible value of the root node 1 after at most k operations? Formally, you have to maximize the value of a_1 . A tree is a connected undirected graph without cycles. A rooted tree is a tree with a selected vertex, which is called the root. The subtree of a node u is the set of all nodes y such that the simple path from y to the root passes through u . Note that u is in the subtree of u . The first line contains an integer t ( 1 <= q t <= q 50 ,000 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains two integers n and k ( 2 <= q n <= q 10^5 , 0 <= q k <= q n ) -- the number of vertices in the tree and the number of operations. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 1000 ), where a_i denotes the value of vertex i . Each of the next n - 1 lines contains two integers u_i and v_i ( 1 <= q u_i, v_i <= q n , u_i neq v_i ), denoting the edge of the tree between vertices u_i and v_i . It is guaranteed that the given edges form a tree. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output the maximum value of the root after performing at most k operations. Both examples have the same tree: For the first test case, you can do two operations as follows: For the second test case, you can do three operations as follows: '...

Tutorials

Codeforces Round #848 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
191652415 wsyhb F Feb. 2, 2023, 3:59 a.m. OK GNU C++14 TESTS 48 390 38195200
191647733 YeahPotato F Feb. 2, 2023, 2:48 a.m. OK GNU C++14 TESTS 47 499 414208000
191599057 WhaleAutoMaton F Feb. 1, 2023, 4:22 p.m. OK GNU C++14 TESTS 46 546 21606400
191603279 NoPotato F Feb. 1, 2023, 4:34 p.m. OK GNU C++14 TESTS 46 576 414208000
191644901 Zimse. F Feb. 2, 2023, 2:01 a.m. OK GNU C++14 TESTS 46 701 411955200
191644253 Lynkcat F Feb. 2, 2023, 1:51 a.m. OK GNU C++14 TESTS 46 904 55603200
191649051 1213James F Feb. 2, 2023, 3:07 a.m. OK GNU C++14 TESTS 48 904 419840000
191649128 Otomochi_Una F Feb. 2, 2023, 3:08 a.m. OK GNU C++14 TESTS 48 1014 414310400
191609128 karrigan0108 F Feb. 1, 2023, 5:31 p.m. OK GNU C++14 TESTS 46 1044 49356800
191615673 adurysk F Feb. 1, 2023, 6:13 p.m. OK GNU C++14 TESTS 46 1403 526028800
191638860 Ronnie007 F Feb. 2, 2023, midnight OK GNU C++17 TESTS 46 296 42598400
191645388 HOLlC F Feb. 2, 2023, 2:09 a.m. OK GNU C++17 TESTS 46 311 17408000
191608712 xiachong F Feb. 1, 2023, 5:29 p.m. OK GNU C++17 TESTS 46 311 101273600
191646763 txl16211 F Feb. 2, 2023, 2:31 a.m. OK GNU C++17 TESTS 46 405 29184000
191609575 Prince_Arthas F Feb. 1, 2023, 5:33 p.m. OK GNU C++17 TESTS 46 421 37171200
191615887 kingofpineapples F Feb. 1, 2023, 6:15 p.m. OK GNU C++17 TESTS 46 436 178483200
191613056 liympanda F Feb. 1, 2023, 5:55 p.m. OK GNU C++17 TESTS 46 514 7168000
191648306 Reddblue F Feb. 2, 2023, 2:56 a.m. OK GNU C++17 TESTS 48 624 419430400
191647001 faresbadr316 F Feb. 2, 2023, 2:35 a.m. OK GNU C++17 TESTS 46 624 419430400
191661274 0x4c F Feb. 2, 2023, 5:44 a.m. OK GNU C++17 TESTS 48 670 413696000
191650866 LXH-cat F Feb. 2, 2023, 3:35 a.m. OK GNU C++17 (64) TESTS 48 280 38297600
191647057 orzdevinwang F Feb. 2, 2023, 2:36 a.m. OK GNU C++17 (64) TESTS 46 327 30822400
191655210 PresentPassed F Feb. 2, 2023, 4:20 a.m. OK GNU C++17 (64) TESTS 48 373 46899200
191594976 kotatsugame F Feb. 1, 2023, 4:08 p.m. OK GNU C++17 (64) TESTS 46 374 34918400
191623844 I_HATE_GEOMETRY F Feb. 1, 2023, 7:34 p.m. OK GNU C++17 (64) TESTS 46 420 97792000
191650734 LXH-cat F Feb. 2, 2023, 3:33 a.m. OK GNU C++17 (64) TESTS 48 436 34201600
191597264 kimoyami F Feb. 1, 2023, 4:16 p.m. OK GNU C++17 (64) TESTS 46 545 37376000
191650345 LXH-cat F Feb. 2, 2023, 3:27 a.m. OK GNU C++17 (64) TESTS 48 670 47513600
191598384 Nyaan F Feb. 1, 2023, 4:20 p.m. OK GNU C++17 (64) TESTS 46 920 56012800
191645566 jinqihao2023 F Feb. 2, 2023, 2:12 a.m. OK GNU C++17 (64) TESTS 46 951 149913600
191637704 BrendanSGubbins F Feb. 1, 2023, 11:26 p.m. OK GNU C++20 (64) TESTS 46 234 35737600
191630105 achvanov F Feb. 1, 2023, 8:57 p.m. OK GNU C++20 (64) TESTS 46 234 35737600
191641247 trigold F Feb. 2, 2023, 12:53 a.m. OK GNU C++20 (64) TESTS 46 280 38604800
191598865 zqyyy F Feb. 1, 2023, 4:21 p.m. OK GNU C++20 (64) TESTS 46 280 52531200
191598480 fallleaves01 F Feb. 1, 2023, 4:20 p.m. OK GNU C++20 (64) TESTS 46 311 47820800
191609584 superguymj F Feb. 1, 2023, 5:33 p.m. OK GNU C++20 (64) TESTS 46 311 86528000
191641320 trigold F Feb. 2, 2023, 12:55 a.m. OK GNU C++20 (64) TESTS 46 312 36966400
191597144 14th_onresp F Feb. 1, 2023, 4:16 p.m. OK GNU C++20 (64) TESTS 46 373 103424000
191641491 trigold F Feb. 2, 2023, 12:59 a.m. OK GNU C++20 (64) TESTS 46 374 49049600
191608478 Ecrade_ F Feb. 1, 2023, 5:28 p.m. OK GNU C++20 (64) TESTS 46 374 64204800
191607263 arvindf232 F Feb. 1, 2023, 5:23 p.m. OK Kotlin 1.6 TESTS 46 592 24166400

remove filters

Back to search problems