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"Fedor runs for president of Byteland! In the debates, he will be asked how to solve Byteland's transport problem. It's a really hard problem because of Byteland's transport system is now a tree (connected graph without cycles). Fedor's team has found out in the ministry of transport of Byteland that there is money in the budget only for one additional road. In the debates, he is going to say that he will build this road as a way to maximize the number of distinct simple paths in the country. A simple path is a path which goes through every vertex no more than once. Two simple paths are named distinct if sets of their edges are distinct. But Byteland's science is deteriorated, so Fedor's team hasn't succeeded to find any scientists to answer how many distinct simple paths they can achieve after adding exactly one edge on the transport system? Help Fedor to solve it. An edge can be added between vertices that are already connected, but it can't be a loop. In this problem, we consider only simple paths of length at least two. The first line contains one integer n ( 2 <= q n <= q 500 000 ) -- number of vertices in Byteland's transport system. Each of the following n - 1 lines contains two integers v_i and u_i ( 1 <= q v_i, u_i <= q n ). It's guaranteed that the graph is tree. Print exactly one integer -- a maximal number of simple paths that can be achieved after adding one edge. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
55984057 |
lzoilxy |
D |
June 24, 2019, 1:17 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
124 |
65843200 |
|
2600 |
59224698 |
HiOkami |
D |
Aug. 21, 2019, 1:23 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
124 |
79974400 |
|
2600 |
59224267 |
HiOkami |
D |
Aug. 21, 2019, 1:15 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
124 |
79974400 |
|
2600 |
56163329 |
ErkkiErkko |
D |
June 27, 2019, 1:15 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
140 |
100044800 |
|
2600 |
55954731 |
LJC00118 |
D |
June 23, 2019, 6:11 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
140 |
106086400 |
|
2600 |
55922922 |
LJC00118 |
D |
June 22, 2019, 8:10 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
140 |
106086400 |
|
2600 |
56068277 |
LJZ_C |
D |
June 26, 2019, 9:04 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
155 |
110592000 |
|
2600 |
55964928 |
PaulShi |
D |
June 23, 2019, 11:33 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
156 |
32051200 |
|
2600 |
55966363 |
luogu_bot3 |
D |
June 23, 2019, 12:21 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
171 |
32051200 |
|
2600 |
57283567 |
foreverlasting |
D |
July 18, 2019, 1:40 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
171 |
40038400 |
|
2600 |
56434713 |
tokitsukaze |
D |
July 2, 2019, 1:37 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
233 |
54374400 |
|
2600 |
55961651 |
mayaohua2003 |
D |
June 23, 2019, 9:53 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
280 |
80076800 |
|
2600 |
55902131 |
natsugiri |
D |
June 21, 2019, 6:58 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
327 |
27955200 |
|
2600 |
56208887 |
nguyenledinh |
D |
June 28, 2019, 9:15 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
342 |
78233600 |
|
2600 |
57977598 |
t90tank |
D |
July 30, 2019, 8:13 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
358 |
62259200 |
|
2600 |
55934227 |
JustasZ |
D |
June 22, 2019, 1:06 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
358 |
86220800 |
|
2600 |
56019124 |
tmwilliamlin168 |
D |
June 25, 2019, 1:12 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
358 |
108236800 |
|
2600 |
55932163 |
cookiedoth |
D |
June 22, 2019, noon |
OK |
GNU C++14 |
TESTS |
106 |
358 |
196300800 |
|
2600 |
55977581 |
SuperJ6 |
D |
June 23, 2019, 6:29 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
373 |
54272000 |
|
2600 |
56189388 |
NotNight |
D |
June 28, 2019, 6:44 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
373 |
78233600 |
|
2600 |
56253579 |
limbo.null |
D |
June 29, 2019, 5:05 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
327 |
41984000 |
|
2600 |
55977262 |
Fly_37 |
D |
June 23, 2019, 6:17 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
327 |
49254400 |
|
2600 |
55977201 |
Fly_37 |
D |
June 23, 2019, 6:14 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
327 |
49254400 |
|
2600 |
55905341 |
RCG |
D |
June 21, 2019, 9:06 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
342 |
43929600 |
|
2600 |
60439006 |
tyzc |
D |
Sept. 12, 2019, 11:46 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
342 |
50073600 |
|
2600 |
56522786 |
denis2111 |
D |
July 4, 2019, 3:43 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
342 |
64307200 |
|
2600 |
56522734 |
vjudge1 |
D |
July 4, 2019, 3:41 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
342 |
64307200 |
|
2600 |
55946792 |
RCG |
D |
June 22, 2019, 8:24 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
358 |
51916800 |
|
2600 |
55922349 |
Isonan |
D |
June 22, 2019, 7:57 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
358 |
126054400 |
|
2600 |
55914713 |
Isonan |
D |
June 22, 2019, 4:44 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
358 |
126054400 |
|
2600 |
66267729 |
dalt |
D |
Dec. 4, 2019, 11:09 a.m. |
OK |
Java 11 |
TESTS |
106 |
1544 |
152883200 |
|
2600 |
66267527 |
dalt |
D |
Dec. 4, 2019, 11:04 a.m. |
OK |
Java 11 |
TESTS |
106 |
1544 |
152985600 |
|
2600 |
55897920 |
Egor |
D |
June 21, 2019, 6:36 p.m. |
OK |
Java 8 |
TESTS |
106 |
374 |
70656000 |
|
2600 |
55897643 |
uwi |
D |
June 21, 2019, 6:34 p.m. |
OK |
Java 8 |
TESTS |
106 |
514 |
80281600 |
|
2600 |
66252818 |
dalt |
D |
Dec. 4, 2019, 3:36 a.m. |
OK |
Java 8 |
TESTS |
106 |
701 |
207155200 |
|
2600 |
55891013 |
Petr |
D |
June 21, 2019, 6:02 p.m. |
OK |
Java 8 |
TESTS |
106 |
904 |
132403200 |
|
2600 |
66254414 |
dalt |
D |
Dec. 4, 2019, 4:59 a.m. |
OK |
Java 8 |
TESTS |
106 |
1123 |
183910400 |
|
2600 |
66252842 |
dalt |
D |
Dec. 4, 2019, 3:37 a.m. |
OK |
Java 8 |
TESTS |
106 |
1138 |
192000000 |
|
2600 |
66254093 |
dalt |
D |
Dec. 4, 2019, 4:46 a.m. |
OK |
Java 8 |
TESTS |
106 |
1169 |
191897600 |
|
2600 |
56007782 |
laofudasuan |
D |
June 24, 2019, 4:29 p.m. |
OK |
Java 8 |
TESTS |
106 |
1341 |
71475200 |
|
2600 |
remove filters
Back to search problems