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.
Problems
B"This version of the problem differs from the previous one only in the constraint on n . A tree is a connected undirected graph without cycles. A weighted tree has a weight assigned to each edge. The distance between two vertices is the minimum sum of weights on the path connecting them. You are given a weighted tree with n vertices, each edge has a weight of 1 . Denote d(v) as the distance between vertex 1 and vertex v . Let f(x) be the minimum possible value of max limits_{1 <= q v <= q n} {d(v)} if you can temporarily add an edge with weight x between any two vertices a and b (1 <= a, b <= n) . Note that after this operation, the graph is no longer a tree. For each integer x from 1 to n , find f(x) . The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 3 cdot 10^5 ). Each of the next n xe2 x88 x921 lines contains two integers u and v ( 1 <= u,v <= n ) indicating that there is an edge between vertices u and v . It is guaranteed that the given edges form a tree. It is guaranteed that the sum of n over all test cases doesn't exceed 3 cdot 10^5 . For each test case, print n integers in a single line, x -th of which is equal to f(x) for all x from 1 to n . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
144605026 |
snowflame |
E2 |
Jan. 31, 2022, 1:04 a.m. |
OK |
GNU C11 |
TESTS |
42 |
1387 |
33792000 |
|
|
144607178 |
xuanxuan001 |
E2 |
Jan. 31, 2022, 2:44 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
312 |
25190400 |
|
|
144614677 |
schrodingerstom |
E2 |
Jan. 31, 2022, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
343 |
37376000 |
|
|
144578093 |
Forza_Ferrari |
E2 |
Jan. 30, 2022, 4:24 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
358 |
21606400 |
|
|
144603881 |
LinkZelda |
E2 |
Jan. 30, 2022, 11:49 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
358 |
35225600 |
|
|
144576257 |
HoshinaSuzu |
E2 |
Jan. 30, 2022, 4:20 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
389 |
49868800 |
|
|
144609235 |
DataStructures |
E2 |
Jan. 31, 2022, 3:43 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
452 |
59084800 |
|
|
144612239 |
UltiMadow |
E2 |
Jan. 31, 2022, 4:45 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
467 |
66252800 |
|
|
144585774 |
KrK |
E2 |
Jan. 30, 2022, 5:20 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
499 |
58982400 |
|
|
144587128 |
xing89qs |
E2 |
Jan. 30, 2022, 5:30 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
592 |
78336000 |
|
|
144586645 |
Potassium |
E2 |
Jan. 30, 2022, 5:26 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
670 |
111513600 |
|
|
144577250 |
wucstdio |
E2 |
Jan. 30, 2022, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
280 |
86528000 |
|
|
144612453 |
dOuOb |
E2 |
Jan. 31, 2022, 4:49 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
296 |
26419200 |
|
|
144599110 |
Tiagodfs |
E2 |
Jan. 30, 2022, 8:26 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
311 |
20889600 |
|
|
144610041 |
hotavn.com |
E2 |
Jan. 31, 2022, 4:02 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
311 |
28979200 |
|
|
144614842 |
xxafhixx |
E2 |
Jan. 31, 2022, 5:28 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
311 |
39833600 |
|
|
144593795 |
YuDabin |
E2 |
Jan. 30, 2022, 6:47 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
326 |
28979200 |
|
|
144603143 |
helcsnewsxd |
E2 |
Jan. 30, 2022, 11:01 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
327 |
28979200 |
|
|
144607602 |
DerekFeng |
E2 |
Jan. 31, 2022, 2:58 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
327 |
31436800 |
|
|
144597188 |
ParsaS |
E2 |
Jan. 30, 2022, 7:46 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
327 |
31436800 |
|
|
144606035 |
blue_warrior |
E2 |
Jan. 31, 2022, 2:01 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
327 |
37376000 |
|
|
144608780 |
Origenes |
E2 |
Jan. 31, 2022, 3:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
280 |
47206400 |
|
|
144597554 |
pakhandi98 |
E2 |
Jan. 30, 2022, 7:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
280 |
54169600 |
|
|
144609433 |
xiaolaogou |
E2 |
Jan. 31, 2022, 3:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
311 |
46899200 |
|
|
144605931 |
treborr |
E2 |
Jan. 31, 2022, 1:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
311 |
53964800 |
|
|
144591449 |
lemu17 |
E2 |
Jan. 30, 2022, 6:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
358 |
66867200 |
|
|
144606367 |
wygzgyw |
E2 |
Jan. 31, 2022, 2:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
389 |
54067200 |
|
|
144581145 |
gazelle |
E2 |
Jan. 30, 2022, 4:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
420 |
49254400 |
|
|
144576060 |
magnified |
E2 |
Jan. 30, 2022, 4:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
420 |
58880000 |
|
|
144593547 |
tourist |
E2 |
Jan. 30, 2022, 6:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
576 |
55603200 |
|
|
144613552 |
Starline |
E2 |
Jan. 31, 2022, 5:09 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
592 |
50483200 |
|
|
144585885 |
generic_placeholder_name |
E2 |
Jan. 30, 2022, 5:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
249 |
48128000 |
|
|
144602510 |
kaiboy |
E2 |
Jan. 30, 2022, 10:24 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
280 |
52838400 |
|
|
144600851 |
silxi |
E2 |
Jan. 30, 2022, 9:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
311 |
28979200 |
|
|
144600822 |
silxi |
E2 |
Jan. 30, 2022, 9:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
311 |
28979200 |
|
|
144600609 |
74TrAkToR |
E2 |
Jan. 30, 2022, 9:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
311 |
75776000 |
|
|
144611029 |
keywet06 |
E2 |
Jan. 31, 2022, 4:22 a.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
312 |
75468800 |
|
|
144574776 |
Venn |
E2 |
Jan. 30, 2022, 4:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
342 |
73625600 |
|
|
144613527 |
ShmilyTY |
E2 |
Jan. 31, 2022, 5:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
343 |
59699200 |
|
|
144594258 |
sayanmedya |
E2 |
Jan. 30, 2022, 6:54 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
358 |
39628800 |
|
|
144576825 |
i_will_be_less_than_blue |
E2 |
Jan. 30, 2022, 4:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
373 |
70246400 |
|
|
144603272 |
anvorguesa |
E2 |
Jan. 30, 2022, 11:09 p.m. |
OK |
Go |
TESTS |
42 |
717 |
119398400 |
|
|
144596011 |
OLOGY |
E2 |
Jan. 30, 2022, 7:23 p.m. |
OK |
PyPy 2 |
TESTS |
42 |
1232 |
135987200 |
|
|
144599132 |
OLOGY |
E2 |
Jan. 30, 2022, 8:26 p.m. |
OK |
PyPy 2 |
TESTS |
42 |
1387 |
136806400 |
|
|
144586339 |
FlakeLCR |
E2 |
Jan. 30, 2022, 5:24 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
873 |
66560000 |
|
|
144586358 |
Igorfardoc |
E2 |
Jan. 30, 2022, 5:24 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
1310 |
80076800 |
|
|
144584759 |
FlakeLCR |
E2 |
Jan. 30, 2022, 5:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
42 |
904 |
83660800 |
|
|
144604384 |
clause |
E2 |
Jan. 31, 2022, 12:23 a.m. |
OK |
Rust 2021 |
TESTS |
42 |
499 |
108236800 |
|
|
remove filters
Back to search problems