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'Copil Copac is given a list of n-1 edges describing a tree of n vertices. He decides to draw it using the following algorithm: The number of readings is defined as the number of times Copil Copac performs step 1 . Find the number of readings needed by Copil Copac to draw the tree. Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of vertices of the tree. The following n - 1 lines of each test case contain two integers u_i and v_i ( 1 <= u_i, v_i <= n , u_i neq v_i ) -- indicating that (u_i,v_i) is the i -th edge in the list. 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 cdot 10^5 . For each test case, output the number of readings Copil Copac needs to draw the tree. In the first test case: After the first reading, the tree will look like this: After the second reading: Therefore, Copil Copac needs 2 readings to draw the tree. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
207595010 |
mban259 |
A |
May 28, 2023, 2:48 p.m. |
OK |
C# 10 |
TESTS |
16 |
343 |
41676800 |
|
|
207603106 |
LeonidR |
A |
May 28, 2023, 2:56 p.m. |
OK |
C# 10 |
TESTS |
16 |
389 |
49152000 |
|
|
207600586 |
DmitriyAnikeyev |
A |
May 28, 2023, 2:53 p.m. |
OK |
C# 10 |
TESTS |
16 |
764 |
116838400 |
|
|
207590096 |
Gassa |
A |
May 28, 2023, 2:43 p.m. |
OK |
D |
TESTS |
16 |
342 |
24678400 |
|
|
207694911 |
E-ray |
A |
May 29, 2023, 1:24 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
93 |
10444800 |
|
|
207691747 |
Shui_Dream |
A |
May 28, 2023, 11:43 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
93 |
10444800 |
|
|
207584556 |
20333333333 |
A |
May 28, 2023, 2:38 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
108 |
25702400 |
|
|
207588632 |
IcMtr |
A |
May 28, 2023, 2:42 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
109 |
8806400 |
|
|
207585764 |
cyh_toby |
A |
May 28, 2023, 2:39 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
109 |
8806400 |
|
|
207597175 |
wutongchun |
A |
May 28, 2023, 2:50 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
109 |
9625600 |
|
|
207590370 |
-LAP- |
A |
May 28, 2023, 2:43 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
109 |
11161600 |
|
|
207586049 |
Flamire |
A |
May 28, 2023, 2:40 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
109 |
11161600 |
|
|
207588197 |
MakaPakka |
A |
May 28, 2023, 2:41 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
124 |
9625600 |
|
|
207696672 |
AuroraAlaska |
A |
May 29, 2023, 2:04 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
124 |
14848000 |
|
|
207695200 |
rqoi031 |
A |
May 29, 2023, 1:30 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
77 |
8806400 |
|
|
207594400 |
MarbIue |
A |
May 28, 2023, 2:47 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
78 |
17510400 |
|
|
207590427 |
KaphI |
A |
May 28, 2023, 2:43 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
109 |
8806400 |
|
|
207605345 |
PaulShi |
A |
May 28, 2023, 2:59 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
109 |
10444800 |
|
|
207596759 |
IndignantHydra |
A |
May 28, 2023, 2:49 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
109 |
10444800 |
|
|
207596523 |
KroosTheKeenGlint |
A |
May 28, 2023, 2:49 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
109 |
11161600 |
|
|
207628537 |
Natsuzora |
A |
May 28, 2023, 3:35 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
109 |
11571200 |
|
|
207586737 |
crazy_sea |
A |
May 28, 2023, 2:40 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
109 |
35225600 |
|
|
207712551 |
drdilyor |
A |
May 29, 2023, 4:48 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
124 |
11161600 |
|
|
207699646 |
_SS |
A |
May 29, 2023, 3 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
124 |
14848000 |
|
|
207586242 |
Z-302 |
A |
May 28, 2023, 2:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
93 |
21504000 |
|
|
207609446 |
HillSideDonkey |
A |
May 28, 2023, 3:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
93 |
31129600 |
|
|
207690891 |
chenxiaoyan |
A |
May 28, 2023, 11:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
124 |
21299200 |
|
|
207596690 |
ahshafi |
A |
May 28, 2023, 2:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
124 |
21299200 |
|
|
207597236 |
Bungmint |
A |
May 28, 2023, 2:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
139 |
22937600 |
|
|
207587236 |
KKT_89 |
A |
May 28, 2023, 2:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
139 |
27750400 |
|
|
207609031 |
efficient |
A |
May 28, 2023, 3:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
140 |
11776000 |
|
|
207597686 |
natsugiri |
A |
May 28, 2023, 2:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
140 |
15462400 |
|
|
207597185 |
TheOneYouWant |
A |
May 28, 2023, 2:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
140 |
16588800 |
|
|
207598007 |
ETK. |
A |
May 28, 2023, 2:51 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
140 |
20582400 |
|
|
207592578 |
Zhouershan |
A |
May 28, 2023, 2:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
31 |
30720000 |
|
|
207587615 |
maspy |
A |
May 28, 2023, 2:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
13312000 |
|
|
207586799 |
shino16 |
A |
May 28, 2023, 2:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
78 |
156057600 |
|
|
207585309 |
Sulfox |
A |
May 28, 2023, 2:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
93 |
24473600 |
|
|
207587981 |
CC2021zyz |
A |
May 28, 2023, 2:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
93 |
29696000 |
|
|
207712179 |
youbot |
A |
May 29, 2023, 4:42 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
93 |
63078400 |
|
|
207589937 |
wery0 |
A |
May 28, 2023, 2:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
108 |
15667200 |
|
|
207694699 |
HHY_zZhu |
A |
May 29, 2023, 1:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
108 |
21299200 |
|
|
207698063 |
afre |
A |
May 29, 2023, 2:31 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
108 |
59289600 |
|
|
207716150 |
Fido_Puppy |
A |
May 29, 2023, 5:41 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
109 |
15462400 |
|
|
207716683 |
0x3F |
A |
May 29, 2023, 5:48 a.m. |
OK |
Go |
TESTS |
16 |
218 |
35737600 |
|
|
207717110 |
0x3F |
A |
May 29, 2023, 5:53 a.m. |
OK |
Go |
TESTS |
16 |
233 |
35737600 |
|
|
207685557 |
LEXA_EBASHIT |
A |
May 28, 2023, 8:39 p.m. |
OK |
Go |
TESTS |
16 |
343 |
49868800 |
|
|
207677914 |
kasiru_69 |
A |
May 28, 2023, 6:46 p.m. |
OK |
Java 11 |
TESTS |
16 |
608 |
39014400 |
|
|
207596710 |
profchi |
A |
May 28, 2023, 2:49 p.m. |
OK |
Java 11 |
TESTS |
16 |
717 |
33382400 |
|
|
207607698 |
jack.t.y.wu |
A |
May 28, 2023, 3:02 p.m. |
OK |
Java 17 |
TESTS |
16 |
904 |
59801600 |
|
|
207661199 |
Virendra115 |
A |
May 28, 2023, 4:49 p.m. |
OK |
Java 8 |
TESTS |
16 |
530 |
38912000 |
|
|
207605483 |
yvbf |
A |
May 28, 2023, 2:59 p.m. |
OK |
Java 8 |
TESTS |
16 |
717 |
64614400 |
|
|
207611148 |
cc4414 |
A |
May 28, 2023, 3:07 p.m. |
OK |
Java 8 |
TESTS |
16 |
935 |
81408000 |
|
|
207583889 |
FastFreeTask |
A |
May 28, 2023, 2:38 p.m. |
OK |
Kotlin 1.6 |
TESTS |
16 |
264 |
6963200 |
|
|
207586026 |
Tlatoani |
A |
May 28, 2023, 2:40 p.m. |
OK |
Kotlin 1.6 |
TESTS |
16 |
857 |
40448000 |
|
|
207589477 |
misorin |
A |
May 28, 2023, 2:43 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
249 |
16793600 |
|
|
207598080 |
hxu10 |
A |
May 28, 2023, 2:51 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
701 |
48435200 |
|
|
207586746 |
SPD_9X2 |
A |
May 28, 2023, 2:40 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
795 |
31846400 |
|
|
207590945 |
kyoran |
A |
May 28, 2023, 2:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
529 |
47001600 |
|
|
207590322 |
chinerist |
A |
May 28, 2023, 2:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
545 |
46899200 |
|
|
207599516 |
mikeac |
A |
May 28, 2023, 2:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
576 |
48025600 |
|
|
207602941 |
alxwen711 |
A |
May 28, 2023, 2:56 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
654 |
80793600 |
|
|
207605165 |
tryharda |
A |
May 28, 2023, 2:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
670 |
53862400 |
|
|
207696656 |
Little_Sheep_Yawn |
A |
May 29, 2023, 2:03 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
717 |
74854400 |
|
|
207589485 |
dyppp |
A |
May 28, 2023, 2:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
748 |
70656000 |
|
|
207607558 |
Maruzensky |
A |
May 28, 2023, 3:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
857 |
104345600 |
|
|
207594254 |
plevande |
A |
May 28, 2023, 2:47 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
951 |
94924800 |
|
|
207612061 |
Alex239 |
A |
May 28, 2023, 3:08 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
951 |
123289600 |
|
|
207602758 |
RustIsBestLang |
A |
May 28, 2023, 2:56 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
93 |
25600000 |
|
|
207589309 |
Egor |
A |
May 28, 2023, 2:43 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
93 |
32460800 |
|
|
207586082 |
sansen |
A |
May 28, 2023, 2:40 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
124 |
38297600 |
|
|
207672211 |
ilyshana |
A |
May 28, 2023, 5:56 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
139 |
40448000 |
|
|
remove filters
Back to search problems