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"One day, Pak Chanek who is already bored of being alone at home decided to go traveling. While looking for an appropriate place, he found that Londonesia has an interesting structure. According to the information gathered by Pak Chanek, there are N cities numbered from 1 to N . The cities are connected to each other with N-1 two-directional roads, with the i -th road connecting cities U_i and V_i , and taking a time of W_i hours to be traversed. In other words, Londonesia's structure forms a tree. Pak Chanek wants to go on a journey in Londonesia starting and ending in any city (not necessarily the same city) such that each city is visited at least once with the least time possible. In order for the journey to end quicker, Pak Chanek also carries an instant teleportation device for moving from one city to any city that can only be used at most once. Help Pak Chanek for finding the minimum time needed. Notes: The first line contains a single integer N ( 1 <= N <= 10^5 ) -- the number of cities in Londonesia. The i -th of the next N-1 lines contains three integers U_i , V_i , and W_i ( 1 <= U_i, V_i <= N , 1 <= W_i <= 10^9 ) -- a two-directional road that connects cities U_i and V_i that takes W_i hours to be traversed. The roads in Londonesia form a tree. Output one integer, which represents the minimum time in hours that is needed to visit each city at least once. In the first example, the journey that has the minimum time is 2 xe2 x86 x92 1 xrightarrow{ text{teleport}} 4 xe2 x86 x92 3 . In the second example, the journey that has the minimum time is 3 xe2 x86 x92 1 xe2 x86 x92 4 xe2 x86 x92 1 xe2 x86 x92 2 xrightarrow{ text{teleport}} 5 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
170855823 |
kaiboy rainboy Dukkha |
J |
Sept. 4, 2022, 2:27 p.m. |
OK |
GNU C11 |
TESTS |
30 |
234 |
20992000 |
|
|
170875183 |
gisp_zjz triple__a Roundgod |
J |
Sept. 4, 2022, 4:57 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
124 |
24780800 |
|
|
170902103 |
Tom66 |
J |
Sept. 5, 2022, 1:10 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
171 |
31232000 |
|
|
170903443 |
rfpermen |
J |
Sept. 5, 2022, 1:48 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
187 |
65945600 |
|
|
170877015 |
Milesian liouzhou_101 lucifer1004 |
J |
Sept. 4, 2022, 5:16 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
109 |
20787200 |
|
|
170882891 |
realcomplex Valters07 ansisgustavs2 |
J |
Sept. 4, 2022, 6:22 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
202 |
39424000 |
|
|
170893027 |
MoNsTeR_CuBe |
J |
Sept. 4, 2022, 8:51 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
202 |
39424000 |
|
|
170903885 |
RGB_ICPC4 |
J |
Sept. 5, 2022, 2 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
327 |
44134400 |
|
|
170881183 |
Pajaraja milisav allllekssssa |
J |
Sept. 4, 2022, 6:03 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
389 |
109465600 |
|
|
170867350 |
SSRS_ riantkb tatyam |
J |
Sept. 4, 2022, 3:49 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
592 |
16076800 |
|
|
170874872 |
kotatsugame |
J |
Sept. 4, 2022, 4:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
139 |
46592000 |
|
|
170863945 |
potato167 |
J |
Sept. 4, 2022, 3:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
155 |
14028800 |
|
|
170861550 |
HollwoQ_Pelw khuepr123 thenymphsofdelphi |
J |
Sept. 4, 2022, 3:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
156 |
41676800 |
|
|
170912248 |
bashkort |
J |
Sept. 5, 2022, 5:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
156 |
52531200 |
|
|
170878905 |
PIachta Sophie_Neuenmuller |
J |
Sept. 4, 2022, 5:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
264 |
43929600 |
|
|
170882675 |
PIachta Sophie_Neuenmuller |
J |
Sept. 4, 2022, 6:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
265 |
43929600 |
|
|
170864262 |
errorgorn |
J |
Sept. 4, 2022, 3:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
30 |
405 |
60723200 |
|
|
170862469 |
qiqi20021026 SSerxhs Randias |
J |
Sept. 4, 2022, 3:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
78 |
38400000 |
|
|
170860845 |
ksun48 |
J |
Sept. 4, 2022, 2:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
109 |
27340800 |
|
|
170881221 |
IntoTheNight brunovsky |
J |
Sept. 4, 2022, 6:03 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
109 |
30515200 |
|
|
170882438 |
Kotoblepass s20b1_chernikov average_gleb_enjoyer |
J |
Sept. 4, 2022, 6:17 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
124 |
40140800 |
|
|
170865057 |
Nur47 neko_nyaaaaaaaaaaaaaaaaa Valenz |
J |
Sept. 4, 2022, 3:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
124 |
54681600 |
|
|
170862778 |
jiangly |
J |
Sept. 4, 2022, 3:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
139 |
32153600 |
|
|
170867011 |
Heltion |
J |
Sept. 4, 2022, 3:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
140 |
34406400 |
|
|
170878858 |
altunyanv zidder _LeMur_ |
J |
Sept. 4, 2022, 5:36 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
140 |
35635200 |
|
|
170879880 |
I_LOVE_DASHA_KARPENKO Wailydest oleh1421 |
J |
Sept. 4, 2022, 5:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
155 |
77926400 |
|
|
170886554 |
The_Joker2000 |
J |
Sept. 4, 2022, 7:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
30 |
156 |
46080000 |
|
|
remove filters
Back to search problems