Codeforces Round 748 (Div. 3)

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
1593 Codeforces Round 748 (Div. 3) FINISHED False 8100 103044262 Oct. 13, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12848 ) E Gardener and Tree PROGRAMMING dfs and similar greedy implementation trees

B'A tree is an undirected connected graph in which there are no cycles. This problem is about non-rooted trees. A leaf of a tree is a vertex that is connected to at most one vertex. The gardener Vitaly grew a tree from n vertices. He decided to trim the tree. To do this, he performs a number of operations. In one operation, he removes all leaves of the tree. For example, consider the tree shown in the figure above. The figure below shows the result of applying exactly one operation to the tree. Note the special cases of the operation: Vitaly applied k operations sequentially to the tree. How many vertices remain? The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then t test cases follow. Each test case is preceded by an empty line. Each test case consists of several lines. The first line of the test case contains two integers n and k ( 1 <= n <= 4 cdot 10^5 , 1 <= k <= 2 cdot 10^5 ) -- the number of vertices in the tree and the number of operations, respectively. Then n - 1 lines follow, each of them contains two integers u and v ( 1 <= u, v <= n , u neq v ) which describe a pair of vertices connected by an edge. It is guaranteed that the given graph is a tree and has no loops or multiple edges. It is guaranteed that the sum of n from all test cases does not exceed 4 cdot 10^5 . For each test case output on a separate line a single integer -- the number of vertices that remain in the tree after applying k operations. The first test case is considered in the statement. The second test case contains a tree of two vertices. 200000 operations are applied to it. The first one removes all two vertices, the other operations do not change the tree. In the third test case, a tree of three vertices is given. As a result of the first operation, only 1 vertex remains in it (with the index 2 ), the second operati'...

Tutorials

Editorial for Codeforces Round #748 (Div.3)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
131945583 bkifhr6 E Oct. 14, 2021, 1:58 p.m. OK GNU C++14 TESTS 36 124 13312000
131945571 Tom66 E Oct. 14, 2021, 1:58 p.m. OK GNU C++14 TESTS 36 124 13312000
131985683 tljfw E Oct. 15, 2021, 1:47 a.m. OK GNU C++14 TESTS 36 217 11571200
131985639 tljfw E Oct. 15, 2021, 1:45 a.m. OK GNU C++14 TESTS 36 218 11980800
131905958 Vocalise E Oct. 14, 2021, 7:35 a.m. OK GNU C++14 TESTS 36 218 57446400
131905716 ZeroBlast E Oct. 14, 2021, 7:32 a.m. OK GNU C++14 TESTS 36 234 11264000
131938243 Aoi_Tori E Oct. 14, 2021, 12:55 p.m. OK GNU C++14 TESTS 36 234 13107200
131985906 tljfw E Oct. 15, 2021, 1:54 a.m. OK GNU C++14 TESTS 36 249 11571200
131913118 frank1586 E Oct. 14, 2021, 8:52 a.m. OK GNU C++14 TESTS 36 249 18944000
131984483 dottle E Oct. 15, 2021, 1:02 a.m. OK GNU C++14 TESTS 36 265 17920000
131909743 hhar E Oct. 14, 2021, 8:12 a.m. OK GNU C++17 TESTS 36 217 28262400
131907520 jxust_hzf E Oct. 14, 2021, 7:49 a.m. OK GNU C++17 TESTS 36 233 13516800
131961806 dark-jk E Oct. 14, 2021, 4:49 p.m. OK GNU C++17 TESTS 36 249 13107200
131907460 jxust_hzf E Oct. 14, 2021, 7:48 a.m. OK GNU C++17 TESTS 36 249 13516800
131940228 zhiqiu E Oct. 14, 2021, 1:11 p.m. OK GNU C++17 TESTS 36 280 11264000
131951889 ccsu_Y_Y E Oct. 14, 2021, 3:01 p.m. OK GNU C++17 TESTS 36 295 11980800
131925602 chenjun2 E Oct. 14, 2021, 11:02 a.m. OK GNU C++17 TESTS 36 295 14745600
131935327 piaobozhe E Oct. 14, 2021, 12:30 p.m. OK GNU C++17 TESTS 36 311 13107200
131909377 wngynng E Oct. 14, 2021, 8:08 a.m. OK GNU C++17 TESTS 36 312 26009600
131988377 ileln E Oct. 15, 2021, 3 a.m. OK GNU C++17 TESTS 36 312 37990400
131923256 BMYqwq E Oct. 14, 2021, 10:40 a.m. OK GNU C++17 (64) TESTS 36 234 47718400
131922926 CartesianTree E Oct. 14, 2021, 10:37 a.m. OK GNU C++17 (64) TESTS 36 234 47718400
131928995 feicheng_ E Oct. 14, 2021, 11:32 a.m. OK GNU C++17 (64) TESTS 36 248 24268800
131905451 zwu2019015083 E Oct. 14, 2021, 7:30 a.m. OK GNU C++17 (64) TESTS 36 249 14643200
131948040 jjjjssss6 E Oct. 14, 2021, 2:20 p.m. OK GNU C++17 (64) TESTS 36 249 26521600
131925948 yfy20020106 E Oct. 14, 2021, 11:05 a.m. OK GNU C++17 (64) TESTS 36 249 30822400
131923815 tbw831 E Oct. 14, 2021, 10:45 a.m. OK GNU C++17 (64) TESTS 36 264 27033600
131976952 captainxop E Oct. 14, 2021, 8:35 p.m. OK GNU C++17 (64) TESTS 36 311 23244800
131944264 H6_6Q E Oct. 14, 2021, 1:47 p.m. OK GNU C++17 (64) TESTS 36 311 26214400
131957946 cout_amogh E Oct. 14, 2021, 4:05 p.m. OK GNU C++17 (64) TESTS 36 312 23449600
131972416 nitin23329 E Oct. 14, 2021, 7:09 p.m. OK Java 11 TESTS 36 920 80588800
131928522 MubtasimShahriar E Oct. 14, 2021, 11:28 a.m. OK Java 11 TESTS 36 951 79052800
131929188 aayushdhakad E Oct. 14, 2021, 11:34 a.m. OK Java 11 TESTS 36 1138 110796800
131934529 insane_banda E Oct. 14, 2021, 12:23 p.m. OK Java 11 TESTS 36 1185 72499200
131961467 dheerajchhatanidc E Oct. 14, 2021, 4:45 p.m. OK Java 11 TESTS 36 1185 103014400
131935949 MrOtter E Oct. 14, 2021, 12:35 p.m. OK Java 11 TESTS 36 1231 118579200
131915840 punitg8 E Oct. 14, 2021, 9:22 a.m. OK Java 11 TESTS 36 1372 94822400
131993452 nitin23329 E Oct. 15, 2021, 4:59 a.m. OK Java 11 TESTS 36 1746 147251200
131934401 MrOtter E Oct. 14, 2021, 12:22 p.m. OK Java 11 TESTS 36 1934 149401600
131933808 MrOtter E Oct. 14, 2021, 12:17 p.m. OK Java 11 TESTS 36 1934 149401600
131945734 Ibrahimovic_The_Lion E Oct. 14, 2021, 1:59 p.m. OK Java 8 TESTS 36 1060 65331200
131988039 gblake31 E Oct. 15, 2021, 2:51 a.m. OK Java 8 TESTS 36 1091 73728000
131985982 coolManit E Oct. 15, 2021, 1:57 a.m. OK Java 8 TESTS 36 1153 75673600
131974958 sedenion E Oct. 14, 2021, 7:53 p.m. OK Java 8 TESTS 36 1154 87142400
131924889 pikachu_pika_pika E Oct. 14, 2021, 10:55 a.m. OK Java 8 TESTS 36 1154 117657600
131924224 dev_14 E Oct. 14, 2021, 10:49 a.m. OK Java 8 TESTS 36 1169 73113600
131978662 invincible777 E Oct. 14, 2021, 9:18 p.m. OK Java 8 TESTS 36 1200 133836800
131909375 Swapniltri E Oct. 14, 2021, 8:08 a.m. OK Java 8 TESTS 36 1231 72806400
131992203 ssingh0271 E Oct. 15, 2021, 4:31 a.m. OK Java 8 TESTS 36 1512 131686400
131919232 pribic E Oct. 14, 2021, 9:57 a.m. OK Java 8 TESTS 36 1512 131686400
131918150 linxiaotian E Oct. 14, 2021, 9:46 a.m. OK Kotlin 1.4 TESTS 36 1528 120115200
131913441 Gompu123 E Oct. 14, 2021, 8:56 a.m. OK Kotlin 1.4 TESTS 36 2308 186880000
131922699 3DpoNCh1k E Oct. 14, 2021, 10:34 a.m. OK Kotlin 1.5 TESTS 36 1513 72908800
131923630 klyuevskiy E Oct. 14, 2021, 10:43 a.m. OK MS C++ 2017 TESTS 36 795 24166400
131965860 9I_HE_TbI_A_9I E Oct. 14, 2021, 5:37 p.m. OK MS C++ 2017 TESTS 36 919 19353600
131905839 enterdawn E Oct. 14, 2021, 7:34 a.m. OK MS C++ 2017 TESTS 36 3884 97996800
131956974 Andybar E Oct. 14, 2021, 3:54 p.m. OK .NET Core C# TESTS 36 1574 158105600
131944731 PhilTheFish E Oct. 14, 2021, 1:51 p.m. OK PyPy 3 TESTS 36 748 60313600
131953044 brthyyjp E Oct. 14, 2021, 3:14 p.m. OK PyPy 3 TESTS 36 919 63795200
131935733 Aronian E Oct. 14, 2021, 12:33 p.m. OK PyPy 3 TESTS 36 1123 57753600
131972999 Aronian E Oct. 14, 2021, 7:19 p.m. OK PyPy 3 TESTS 36 1154 59801600
131982323 derghost E Oct. 14, 2021, 11:23 p.m. OK PyPy 3 TESTS 36 1231 48435200
131972215 Aronian E Oct. 14, 2021, 7:06 p.m. OK PyPy 3 TESTS 36 1231 48537600
131974445 Aronian E Oct. 14, 2021, 7:45 p.m. OK PyPy 3 TESTS 36 1247 59904000
131906311 krishna369 E Oct. 14, 2021, 7:38 a.m. OK PyPy 3 TESTS 36 1263 42803200
131921003 customaddone E Oct. 14, 2021, 10:17 a.m. OK PyPy 3 TESTS 36 1263 59392000
131976754 WarpMaster E Oct. 14, 2021, 8:30 p.m. OK PyPy 3 TESTS 36 1278 57753600
131978618 HETRAKESHFADIA E Oct. 14, 2021, 9:17 p.m. OK PyPy 3-64 TESTS 36 748 82124800
131975756 sPARTY E Oct. 14, 2021, 8:09 p.m. OK PyPy 3-64 TESTS 36 1045 101888000
131978104 KeiTsukishima E Oct. 14, 2021, 9:02 p.m. OK PyPy 3-64 TESTS 36 1934 86835200
131966241 freakbuoyancy E Oct. 14, 2021, 5:42 p.m. OK PyPy 3-64 TESTS 36 3790 186880000
131929114 htlam E Oct. 14, 2021, 11:33 a.m. OK Python 3 TESTS 36 1575 79974400
131930643 Up_there E Oct. 14, 2021, 11:48 a.m. OK Python 3 TESTS 36 1949 52940800
131942955 sh1194 E Oct. 14, 2021, 1:35 p.m. OK Python 3 TESTS 36 2011 85299200
131905375 xyxoro E Oct. 14, 2021, 7:29 a.m. OK Python 3 TESTS 36 2043 80076800
131958873 slskrish1998 E Oct. 14, 2021, 4:15 p.m. OK Python 3 TESTS 36 2183 79974400
131906005 YellowFlash20 E Oct. 14, 2021, 7:35 a.m. OK Python 3 TESTS 36 2948 86835200
131994825 kumalimak E Oct. 15, 2021, 5:28 a.m. OK Rust TESTS 36 249 22425600
131962233 avm E Oct. 14, 2021, 4:55 p.m. OK Rust TESTS 36 311 23347200
131928672 Spheniscine E Oct. 14, 2021, 11:29 a.m. OK Rust TESTS 36 373 39219200
131930309 Spheniscine E Oct. 14, 2021, 11:45 a.m. OK Rust TESTS 36 483 41984000
131928792 Spheniscine E Oct. 14, 2021, 11:30 a.m. OK Rust TESTS 36 483 45158400

remove filters

Back to search problems