Codeforces Round 932 (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
1935 Codeforces Round 932 (Div. 2) FINISHED False 7200 27530663 March 5, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 463 ) F Andrey's Tree PROGRAMMING binary search constructive algorithms ds greedy implementation trees

B"Master Andrey loves trees ^{ dagger} very much, so he has a tree consisting of n vertices. But it's not that simple. Master Timofey decided to steal one vertex from the tree. If Timofey stole vertex v from the tree, then vertex v and all edges with one end at vertex v are removed from the tree, while the numbers of other vertices remain unchanged. To prevent Andrey from getting upset, Timofey decided to make the resulting graph a tree again. To do this, he can add edges between any vertices a and b , but when adding such an edge, he must pay |a - b| coins to the Master's Assistance Center. Note that the resulting tree does not contain vertex v . Timofey has not yet decided which vertex v he will remove from the tree, so he wants to know for each vertex 1 <= q v <= q n , the minimum number of coins needed to be spent to make the graph a tree again after removing vertex v , as well as which edges need to be added. ^{ dagger} A tree is an undirected connected graph without cycles. Each test consists of multiple test cases. The first line contains a single 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 a single integer n ( 5 <= n <= 2 cdot10^5 ) -- the number of vertices in Andrey's tree. The next n - 1 lines contain a description of the tree's edges. The i -th of these lines contains two integers u_i and v_i ( 1 <= u_i, v_i <= n ) -- the numbers of vertices connected by the i -th edge. 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 cdot10^5 . For each test case, output the answer in the following format: For each vertex v (in the order from 1 to n ), in the first line output two integers w and m -- the minimum number o"...

Tutorials

Codeforces Round #932 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
249834627 Ant_Man F March 5, 2024, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 75 405 27750400
249885958 Hurrikale F March 6, 2024, 4:45 a.m. OK C++17 (GCC 7-32) TESTS 75 420 55296000
249851647 liympanda F March 5, 2024, 7:01 p.m. OK C++17 (GCC 7-32) TESTS 75 436 17408000
249833072 Ant_Man F March 5, 2024, 5:02 p.m. OK C++17 (GCC 7-32) TESTS 75 452 32563200
249874231 relyt871 F March 6, 2024, 12:59 a.m. OK C++17 (GCC 7-32) TESTS 75 514 45875200
249876689 ikaurov F March 6, 2024, 1:59 a.m. OK C++17 (GCC 7-32) TESTS 75 608 221696000
249884100 lamduybao03 F March 6, 2024, 4:16 a.m. OK C++17 (GCC 7-32) TESTS 75 623 89190400
249829995 Coling F March 5, 2024, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 75 764 86732800
249855850 Heart_Blue F March 5, 2024, 7:38 p.m. OK C++17 (GCC 7-32) TESTS 75 951 62976000
249884561 MridulAhi F March 6, 2024, 4:24 a.m. OK C++17 (GCC 7-32) TESTS 75 1294 84480000
249867018 lunchbox F March 5, 2024, 9:56 p.m. OK C++17 (GCC 9-64) TESTS 75 327 43212800
249881743 H_W_Y F March 6, 2024, 3:37 a.m. OK C++17 (GCC 9-64) TESTS 75 374 80179200
249881782 H_W_Y F March 6, 2024, 3:37 a.m. OK C++17 (GCC 9-64) TESTS 75 405 80179200
249874764 Nobody.Emissary F March 6, 2024, 1:14 a.m. OK C++17 (GCC 9-64) TESTS 75 451 77721600
249874749 Nobody.Emissary F March 6, 2024, 1:13 a.m. OK C++17 (GCC 9-64) TESTS 75 452 77721600
249877030 Nobody.Emissary F March 6, 2024, 2:07 a.m. OK C++17 (GCC 9-64) TESTS 75 468 77721600
249880996 SGColin F March 6, 2024, 3:25 a.m. OK C++17 (GCC 9-64) TESTS 75 638 110694400
249853003 arman_ferdous F March 5, 2024, 7:13 p.m. OK C++17 (GCC 9-64) TESTS 75 670 111513600
249873138 jason_sun F March 6, 2024, 12:30 a.m. OK C++17 (GCC 9-64) TESTS 75 3026 249139200
249874321 cmk666 F March 6, 2024, 1:02 a.m. OK C++20 (GCC 11-64) TESTS 75 265 95027200
249882628 sunkuangzheng F March 6, 2024, 3:53 a.m. OK C++20 (GCC 11-64) TESTS 75 280 136704000
249883837 sunkuangzheng F March 6, 2024, 4:12 a.m. OK C++20 (GCC 11-64) TESTS 75 296 136704000
249886527 A_G F March 6, 2024, 4:52 a.m. OK C++20 (GCC 11-64) TESTS 75 311 45670400
249889110 Saya_Alter_ F March 6, 2024, 5:25 a.m. OK C++20 (GCC 11-64) TESTS 75 312 61644800
249842916 tiom4eg F March 5, 2024, 5:56 p.m. OK C++20 (GCC 11-64) TESTS 75 327 24371200
249872014 NeverCompromise F March 5, 2024, 11:57 p.m. OK C++20 (GCC 11-64) TESTS 75 343 118784000
249848281 2qbingxuan F March 5, 2024, 6:34 p.m. OK C++20 (GCC 11-64) TESTS 75 358 114790400
249853628 NeverCompromise F March 5, 2024, 7:18 p.m. OK C++20 (GCC 11-64) TESTS 75 358 118784000
249881646 H_W_Y F March 6, 2024, 3:35 a.m. OK C++20 (GCC 11-64) TESTS 75 373 83353600

remove filters

Back to search problems