Codeforces Round 867 (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
1822 Codeforces Round 867 (Div. 3) FINISHED False 8100 54833063 April 24, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6426 ) F Gardening Friends PROGRAMMING brute force dfs and similar dp graphs trees

B'Two friends, Alisa and Yuki, planted a tree with n vertices in their garden. A tree is an undirected graph without cycles, loops, or multiple edges. Each edge in this tree has a length of k . Initially, vertex 1 is the root of the tree. Alisa and Yuki are growing the tree not just for fun, they want to sell it. The cost of the tree is defined as the maximum distance from the root to a vertex among all vertices of the tree. The distance between two vertices u and v is the sum of the lengths of the edges on the path from u to v . The girls took a course in gardening, so they know how to modify the tree. Alisa and Yuki can spend c coins to shift the root of the tree to one of the neighbors of the current root. This operation can be performed any number of times (possibly zero). Note that the structure of the tree is left unchanged; the only change is which vertex is the root. The friends want to sell the tree with the maximum profit. The profit is defined as the difference between the cost of the tree and the total cost of operations. The profit is cost of the tree minus the total cost of operations. Help the girls and find the maximum profit they can get by applying operations to the tree any number of times (possibly zero). The first line of the input contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains integers n , k , c ( 2 <= n <= 2 cdot 10^5 ; 1 <= k, c <= 10^9 ) -- the number of vertices in the tree, the length of each edge, and the cost of the operation. The next n - 1 lines of the test case contain pairs of integers u_i , v_i ( 1 <= u_i, v_i <= n ) -- the edges of the graph. These edges form a tree. The sum of the values of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer xe2 x80'...

Tutorials

Codeforces Round #867 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
203380963 lAMaLOSER F April 25, 2023, 12:33 a.m. OK C# 10 TESTS 23 405 71168000
203396286 1695651 F April 25, 2023, 5:03 a.m. OK GNU C++14 TESTS 23 124 19968000
203386387 biltharesatyendra F April 25, 2023, 2:27 a.m. OK GNU C++14 TESTS 23 186 19865600
203361060 GIVE_UP F April 24, 2023, 6:53 p.m. OK GNU C++14 TESTS 23 186 36864000
203392732 Zyras F April 25, 2023, 4:07 a.m. OK GNU C++14 TESTS 23 202 17817600
203351909 PuitungChan F April 24, 2023, 5:30 p.m. OK GNU C++14 TESTS 23 202 30412800
203366777 algoboi F April 24, 2023, 7:57 p.m. OK GNU C++14 TESTS 23 202 41881600
203384603 biltharesatyendra F April 25, 2023, 1:51 a.m. OK GNU C++14 TESTS 23 217 11264000
203361973 Ishjazz F April 24, 2023, 7:02 p.m. OK GNU C++14 TESTS 23 217 31436800
203346533 drexdelta1 F April 24, 2023, 4:58 p.m. OK GNU C++14 TESTS 23 217 43724800
203393490 Royo F April 25, 2023, 4:20 a.m. OK GNU C++14 TESTS 23 218 18227200
203345854 konb1 F April 24, 2023, 4:55 p.m. OK GNU C++17 TESTS 23 124 22425600
203371316 AhmedM00 F April 24, 2023, 9:04 p.m. OK GNU C++17 TESTS 23 156 8192000
203389051 xjwwjx F April 25, 2023, 3:13 a.m. OK GNU C++17 TESTS 23 171 21606400
203399157 Haitham_Abu_El_Nasr F April 25, 2023, 5:43 a.m. OK GNU C++17 TESTS 23 171 26624000
203357737 Spensa F April 24, 2023, 6:20 p.m. OK GNU C++17 TESTS 23 171 26624000
203375021 Uniq0rn F April 24, 2023, 10:15 p.m. OK GNU C++17 TESTS 23 186 11366400
203390465 Mkswll F April 25, 2023, 3:34 a.m. OK GNU C++17 TESTS 23 186 20787200
203396890 AhmedKashkoush F April 25, 2023, 5:12 a.m. OK GNU C++17 TESTS 23 186 20992000
203387903 Android1257 F April 25, 2023, 2:54 a.m. OK GNU C++17 TESTS 23 186 20992000
203345911 wuchengyi F April 24, 2023, 4:55 p.m. OK GNU C++17 TESTS 23 186 64102400
203385105 Newbie_QQH F April 25, 2023, 2:01 a.m. OK GNU C++17 (64) TESTS 23 139 35225600
203384089 CCSU_Wine F April 25, 2023, 1:41 a.m. OK GNU C++17 (64) TESTS 23 186 35225600
203348552 Lzq_Wmq F April 24, 2023, 5:08 p.m. OK GNU C++17 (64) TESTS 23 186 40038400
203383861 Xylenox F April 25, 2023, 1:35 a.m. OK GNU C++17 (64) TESTS 23 187 36044800
203350547 M-uwu F April 24, 2023, 5:20 p.m. OK GNU C++17 (64) TESTS 23 202 31744000
203349918 M-uwu F April 24, 2023, 5:16 p.m. OK GNU C++17 (64) TESTS 23 202 31744000
203400365 Scarlett_girl F April 25, 2023, 6 a.m. OK GNU C++17 (64) TESTS 23 202 39833600
203365334 PLA_Nh F April 24, 2023, 7:39 p.m. OK GNU C++17 (64) TESTS 23 233 40038400
203366532 mehul1512 F April 24, 2023, 7:54 p.m. OK GNU C++17 (64) TESTS 23 233 46080000
203391330 RohitRKS F April 25, 2023, 3:46 a.m. OK GNU C++17 (64) TESTS 23 248 29593600
203384797 Kidding__Ma F April 25, 2023, 1:55 a.m. OK GNU C++20 (64) TESTS 23 124 10956800
203398332 stdforces F April 25, 2023, 5:31 a.m. OK GNU C++20 (64) TESTS 23 124 26419200
203348084 huangxw F April 24, 2023, 5:06 p.m. OK GNU C++20 (64) TESTS 23 124 35225600
203396921 sxye F April 25, 2023, 5:12 a.m. OK GNU C++20 (64) TESTS 23 139 36864000
203393121 lococ F April 25, 2023, 4:14 a.m. OK GNU C++20 (64) TESTS 23 140 13312000
203394616 ONE_Sensei F April 25, 2023, 4:38 a.m. OK GNU C++20 (64) TESTS 23 140 14131200
203392297 afre F April 25, 2023, 4:01 a.m. OK GNU C++20 (64) TESTS 23 140 50483200
203365760 atishkumar F April 24, 2023, 7:44 p.m. OK GNU C++20 (64) TESTS 23 155 33382400
203348738 N00BGH0ST F April 24, 2023, 5:09 p.m. OK GNU C++20 (64) TESTS 23 155 37580800
203369389 Nipen_Paul F April 24, 2023, 8:35 p.m. OK GNU C++20 (64) TESTS 23 155 42393600
203363144 v13 F April 24, 2023, 7:14 p.m. OK Go TESTS 23 482 86425600
203392441 ch2001 F April 25, 2023, 4:03 a.m. OK Java 11 TESTS 23 546 73216000
203345848 dzhi F April 24, 2023, 4:55 p.m. OK Java 11 TESTS 23 920 67993600
203353398 nihals.ug20.ee F April 24, 2023, 5:41 p.m. OK Java 11 TESTS 23 1637 202342400
203395027 the_unseen F April 25, 2023, 4:44 a.m. OK Java 11 TESTS 23 1699 88678400
203349312 Ani_S F April 24, 2023, 5:12 p.m. OK Java 17 TESTS 23 1028 117964800
203345689 Mamimi F April 24, 2023, 4:55 p.m. OK Java 17 TESTS 23 1435 111206400
203388373 CCS_Covenant F April 25, 2023, 3:02 a.m. OK Java 17 TESTS 23 1746 210944000
203345227 chuquwan9964 F April 24, 2023, 4:53 p.m. OK Java 8 TESTS 23 654 51916800
203353652 sachinjaiswal F April 24, 2023, 5:43 p.m. OK Java 8 TESTS 23 1309 165683200
203349997 Alex239 F April 24, 2023, 5:17 p.m. OK PyPy 3 TESTS 23 670 24576000
203382366 just-a-byte F April 25, 2023, 1:04 a.m. OK PyPy 3-64 TESTS 23 311 35532800
203375501 nush24 F April 24, 2023, 10:25 p.m. OK PyPy 3-64 TESTS 23 312 35532800
203356053 Andrei_Kuz F April 24, 2023, 6:04 p.m. OK PyPy 3-64 TESTS 23 576 46899200
203376251 SoleProprietor F April 24, 2023, 10:41 p.m. OK PyPy 3-64 TESTS 23 716 58470400
203356018 200815147 F April 24, 2023, 6:03 p.m. OK PyPy 3-64 TESTS 23 779 51302400
203363883 gardengnome F April 24, 2023, 7:22 p.m. OK PyPy 3-64 TESTS 23 794 37785600
203361032 AyuAnchor F April 24, 2023, 6:52 p.m. OK PyPy 3-64 TESTS 23 810 40243200
203352319 2025 F April 24, 2023, 5:32 p.m. OK PyPy 3-64 TESTS 23 810 40243200
203349636 hvbird F April 24, 2023, 5:15 p.m. OK PyPy 3-64 TESTS 23 904 84172800
203346634 lfss_zxj F April 24, 2023, 4:59 p.m. OK PyPy 3-64 TESTS 23 919 124928000
203355764 samriddhjn F April 24, 2023, 6:01 p.m. OK Python 3 TESTS 23 1606 35020800
203347812 namans777 F April 24, 2023, 5:04 p.m. OK Python 3 TESTS 23 1700 39628800
203396072 cpchenpi F April 25, 2023, 5 a.m. OK Rust 2021 TESTS 23 124 20787200

remove filters

Back to search problems