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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
1984
|
Codeforces Global Round 26 |
FINISHED |
False |
10800 |
13879499 |
June 9, 2024, 2:35 p.m. |
Problems
B'Two hungry red pandas, Oscar and Lura, have a tree T with n nodes. They are willing to perform the following shuffle procedure on the whole tree T exactly once. With this shuffle procedure, they will create a new tree out of the nodes of the old tree. After this, Oscar and Lura are left with a new tree T_2 . They can only eat leaves and are very hungry, so please find the maximum number of leaves over all trees that can be created in exactly one shuffle. Note that leaves are all nodes with degree 1 . Thus, the root may be considered as a leaf if it has only one child. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The first line of every test case contains a single integer n ( 2 <= q n <= q 2 cdot 10^5 ) -- the number of nodes within the original tree T . The next n - 1 lines each contain two integers u and v ( 1 <= q u, v <= q n ) -- an edge within the original tree T . The given edges form a tree. The sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case, output a single integer -- the maximum number of leaves achievable with exactly one shuffle procedure on the whole tree. In the first test case, it can be shown that the maximum number of leaves is 4 . To accomplish this, we can start our shuffle with selecting node 3 as the new root. In our second test case, we have a line of five nodes. It can be shown that the maximum number of leaves after one shuffle is 3 . We can start off with node 2 , which forces node 1 to become a leaf. Then, if we select node 4 on the right side, we will also have nodes 3 and 5 as leaves. The third test case is a star graph with six nodes. The number of leaves cannot increase, thus our answer will be 5 (if we start the shuffling with the original root node). '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
264985704 |
a999999 |
E |
June 10, 2024, 12:18 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
109 |
15667200 |
|
|
264994831 |
liyouran |
E |
June 10, 2024, 3:23 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
140 |
7782400 |
|
|
264984908 |
yswn |
E |
June 9, 2024, 11:52 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
140 |
10752000 |
|
|
264957063 |
Rigel__ |
E |
June 9, 2024, 5:16 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
155 |
9011200 |
|
|
264953021 |
icyM3tra |
E |
June 9, 2024, 5:02 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
156 |
14028800 |
|
|
265000619 |
heaksicn |
E |
June 10, 2024, 4:46 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
171 |
6451200 |
|
|
264959764 |
BreakPlus |
E |
June 9, 2024, 5:26 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
218 |
28569600 |
|
|
264961063 |
LUlululu1616 |
E |
June 9, 2024, 5:30 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
1671 |
35430400 |
|
|
264973364 |
Alpha_Q |
E |
June 9, 2024, 7:55 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
125 |
9830400 |
|
|
264998794 |
zc2707 |
E |
June 10, 2024, 4:22 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
140 |
7884800 |
|
|
264962082 |
10tus |
E |
June 9, 2024, 5:33 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
140 |
9216000 |
|
|
265004559 |
Hurrikale |
E |
June 10, 2024, 5:32 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
140 |
10240000 |
|
|
264995892 |
HanZhongBalls |
E |
June 10, 2024, 3:39 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
140 |
11366400 |
|
|
264994609 |
tenkei |
E |
June 10, 2024, 3:20 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
155 |
6041600 |
|
|
264972779 |
serotonin |
E |
June 9, 2024, 7:48 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
155 |
7577600 |
|
|
264969222 |
prairie2022 |
E |
June 9, 2024, 7:04 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
155 |
7577600 |
|
|
264955886 |
PoiFakeRe |
E |
June 9, 2024, 5:12 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
155 |
7884800 |
|
|
264996658 |
luanmenglei |
E |
June 10, 2024, 3:51 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
155 |
8192000 |
|
|
264972898 |
qmk |
E |
June 9, 2024, 7:49 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
210432000 |
|
|
264993304 |
shattershade |
E |
June 10, 2024, 2:59 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
93 |
16076800 |
|
|
264966131 |
ImmortaLimit |
E |
June 9, 2024, 6:37 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
93 |
33075200 |
|
|
264971027 |
adamant |
E |
June 9, 2024, 7:25 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
9113600 |
|
|
264970655 |
qmk |
E |
June 9, 2024, 7:21 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
9113600 |
|
|
264958750 |
magga |
E |
June 9, 2024, 5:22 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
9625600 |
|
|
264994093 |
Aria_Math |
E |
June 10, 2024, 3:12 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
13824000 |
|
|
264991490 |
lprdsb |
E |
June 10, 2024, 2:30 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
14540800 |
|
|
264960874 |
BlueDiamond |
E |
June 9, 2024, 5:30 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
16998400 |
|
|
264956892 |
jay_jayjay |
E |
June 9, 2024, 5:16 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
124 |
18329600 |
|
|
264960547 |
Gassa |
E |
June 9, 2024, 5:28 p.m. |
OK |
D |
TESTS |
13 |
311 |
21504000 |
|
|
264955152 |
chro4896 |
E |
June 9, 2024, 5:09 p.m. |
OK |
GNU C11 |
TESTS |
13 |
124 |
12595200 |
|
|
264956156 |
misorin |
E |
June 9, 2024, 5:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
546 |
27443200 |
|
|
264965501 |
toomer |
E |
June 9, 2024, 6:33 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
77 |
13824000 |
|
|
265003461 |
M1ngXu |
E |
June 10, 2024, 5:20 a.m. |
OK |
Rust 2021 |
TESTS |
13 |
203 |
19046400 |
|
|
remove filters
Back to search problems