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'A tree is an undirected graph with exactly one simple path between each pair of vertices. We call a set of simple paths k -valid if each vertex of the tree belongs to no more than one of these paths (including endpoints) and each path consists of exactly k vertices. You are given a tree with n vertices. For each k from 1 to n inclusive find what is the maximum possible size of a k -valid set of simple paths. The first line of the input contains a single integer n ( 2 <= n <= 100 ,000 ) -- the number of vertices in the tree. Then following n - 1 lines describe the tree, each of them contains two integers v , u ( 1 <= v, u <= n ) -- endpoints of the corresponding edge. It is guaranteed, that the given graph is a tree. Output n numbers, the i -th of which is the maximum possible number of paths in an i -valid set of paths. One way to achieve the optimal number of paths for the second sample is illustrated in the following picture: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
42519985 |
Gassa |
D |
Sept. 5, 2018, 6:03 p.m. |
OK |
D |
TESTS |
60 |
5646 |
16588800 |
|
2700 |
45028809 |
little_gift |
D |
Oct. 29, 2018, 1:25 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
420 |
33484800 |
|
2700 |
45030368 |
little_gift |
D |
Oct. 29, 2018, 3:19 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
452 |
33484800 |
|
2700 |
52512172 |
Dust1404 |
D |
April 9, 2019, 12:48 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
483 |
10956800 |
|
2700 |
46894804 |
Feeey |
D |
Dec. 11, 2018, 8:35 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
514 |
14233600 |
|
2700 |
43590505 |
krijgertje |
D |
Sept. 30, 2018, 12:59 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
514 |
51916800 |
|
2700 |
44991004 |
mrsrz |
D |
Oct. 28, 2018, 12:51 p.m. |
OK |
GNU C++11 |
TESTS |
60 |
545 |
8499200 |
|
2700 |
43021415 |
FizzyDavid |
D |
Sept. 18, 2018, 5:19 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
546 |
10649600 |
|
2700 |
42787674 |
00zj |
D |
Sept. 12, 2018, 5:53 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
592 |
6246400 |
|
2700 |
42695965 |
ReaLNero1 |
D |
Sept. 9, 2018, 7:11 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
592 |
8704000 |
|
2700 |
42535084 |
scott_wu |
D |
Sept. 6, 2018, 12:26 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
592 |
8704000 |
|
2700 |
42539769 |
ecnerwala |
D |
Sept. 6, 2018, 5:04 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
576 |
6758400 |
|
2700 |
42539538 |
ecnerwala |
D |
Sept. 6, 2018, 4:53 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
592 |
6246400 |
|
2700 |
42548895 |
shdut |
D |
Sept. 6, 2018, 10:51 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
655 |
5939200 |
|
2700 |
42767265 |
consecutivelimit |
D |
Sept. 11, 2018, 1:46 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
686 |
6860800 |
|
2700 |
59808795 |
DimmyT |
D |
Aug. 31, 2019, 12:54 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
748 |
6963200 |
|
2700 |
45125655 |
dai |
D |
Oct. 31, 2018, 7:52 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
748 |
132608000 |
|
2700 |
45281352 |
farukkastamonuda |
D |
Nov. 4, 2018, 1:58 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
811 |
10240000 |
|
2700 |
45124693 |
dai |
D |
Oct. 31, 2018, 7:16 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
826 |
137932800 |
|
2700 |
42889271 |
littlelittlehorse |
D |
Sept. 15, 2018, 11:53 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
873 |
5632000 |
|
2700 |
42713783 |
vjudge5 |
D |
Sept. 9, 2018, 5:46 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
889 |
10854400 |
|
2700 |
42816308 |
wxh010910 |
D |
Sept. 13, 2018, 1:56 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
327 |
64307200 |
|
2700 |
42816279 |
wxh010910 |
D |
Sept. 13, 2018, 1:54 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
373 |
56832000 |
|
2700 |
68851120 |
jiangly |
D |
Jan. 15, 2020, 8:59 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
701 |
8806400 |
|
2700 |
42590181 |
I_hate_ACM |
D |
Sept. 6, 2018, 7:22 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
826 |
14745600 |
|
2700 |
42846116 |
tamionv |
D |
Sept. 13, 2018, 11:40 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
873 |
15155200 |
|
2700 |
42816295 |
wxh010910 |
D |
Sept. 13, 2018, 1:55 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
873 |
209510400 |
|
2700 |
42547414 |
AllCatsAreBeautiful |
D |
Sept. 6, 2018, 9:55 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
919 |
11571200 |
|
2700 |
42547390 |
AllCatsAreBeautiful |
D |
Sept. 6, 2018, 9:54 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
935 |
11571200 |
|
2700 |
42535146 |
neal |
D |
Sept. 6, 2018, 12:30 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
982 |
8499200 |
|
2700 |
42788604 |
KATATONIA |
D |
Sept. 12, 2018, 6:43 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
1060 |
11468800 |
|
2700 |
68868068 |
dalt |
D |
Jan. 15, 2020, 2:12 p.m. |
OK |
Java 8 |
TESTS |
60 |
1200 |
88678400 |
|
2700 |
43908958 |
Kamikaze |
D |
Oct. 6, 2018, 3:19 p.m. |
OK |
Java 8 |
TESTS |
60 |
1325 |
55296000 |
|
2700 |
42512974 |
Petr |
D |
Sept. 5, 2018, 5:29 p.m. |
OK |
Java 8 |
TESTS |
60 |
1435 |
55296000 |
|
2700 |
42644440 |
fetetriste |
D |
Sept. 7, 2018, 4:31 p.m. |
OK |
Java 8 |
TESTS |
60 |
1575 |
0 |
|
2700 |
42557570 |
Suzukaze |
D |
Sept. 6, 2018, 2:55 p.m. |
OK |
Java 8 |
TESTS |
60 |
1778 |
49971200 |
|
2700 |
42519616 |
mmaxio |
D |
Sept. 5, 2018, 6:01 p.m. |
OK |
Java 8 |
TESTS |
60 |
2011 |
4096000 |
|
2700 |
42643894 |
fetetriste |
D |
Sept. 7, 2018, 4:28 p.m. |
OK |
Java 8 |
TESTS |
60 |
2027 |
0 |
|
2700 |
42645832 |
fetetriste |
D |
Sept. 7, 2018, 4:35 p.m. |
OK |
Java 8 |
TESTS |
60 |
2074 |
0 |
|
2700 |
42644504 |
fetetriste |
D |
Sept. 7, 2018, 4:31 p.m. |
OK |
Java 8 |
TESTS |
60 |
2105 |
0 |
|
2700 |
42645265 |
fetetriste |
D |
Sept. 7, 2018, 4:33 p.m. |
OK |
Java 8 |
TESTS |
60 |
2199 |
0 |
|
2700 |
remove filters
Back to search problems