Codeforces Round 720 (Div. 2)

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
1521 Codeforces Round 720 (Div. 2) FINISHED False 8100 116781863 May 7, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2005 ) D Nastia Plays with a Tree PROGRAMMING constructive algorithms data structures dfs and similar dp flows graphs greedy implementation trees

B"Nastia has an unweighted tree with n vertices and wants to play with it! The girl will perform the following operation with her tree, as long as she needs: What is the minimum number of operations Nastia needs to get a bamboo from a tree? A bamboo is a tree in which no node has a degree greater than 2 . The first line contains a single integer t ( 1 <= t <= 10 ,000 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 10^5 ) -- the number of vertices in the tree. Next n - 1 lines of each test cases describe the edges of the tree in form a_i , b_i ( 1 <= a_i, b_i <= n , a_i neq b_i ). It's guaranteed the given graph is a tree and the sum of n in one test doesn't exceed 2 cdot 10^5 . For each test case in the first line print a single integer k -- the minimum number of operations required to obtain a bamboo from the initial tree. In the next k lines print 4 integers x_1 , y_1 , x_2 , y_2 ( 1 <= x_1, y_1, x_2, y_{2} <= n , x_1 neq y_1 , x_2 neq y_2 ) -- this way you remove the edge (x_1, y_1) and add an undirected edge (x_2, y_2) . Note that the edge (x_1, y_1) must be present in the graph at the moment of removing. Note the graph can be unconnected after a certain operation. Consider the first test case of the example: "...

Tutorials

90477

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
115626813 rainboy D May 7, 2021, 6:19 p.m. OK GNU C11 TESTS 63 951 9216000
115656553 walk_alone D May 8, 2021, 3:39 a.m. OK GNU C++11 TESTS 63 155 10137600
115658129 Lqingyi D May 8, 2021, 4:07 a.m. OK GNU C++11 TESTS 63 155 12185600
115654699 Lqingyi D May 8, 2021, 3:08 a.m. OK GNU C++11 TESTS 63 170 12185600
115651827 return_zero D May 8, 2021, 2:15 a.m. OK GNU C++11 TESTS 63 171 10854400
115652818 Doc_Di D May 8, 2021, 2:34 a.m. OK GNU C++11 TESTS 63 202 10854400
115661834 sjFu1412 D May 8, 2021, 5:03 a.m. OK GNU C++11 TESTS 63 233 13004800
115624827 fried-chicken D May 7, 2021, 6:01 p.m. OK GNU C++11 TESTS 63 234 14950400
115650569 LegendaryYYQ final_trump Social_Zhao D May 8, 2021, 1:47 a.m. OK GNU C++11 TESTS 63 264 24166400
115653144 Social_Zhao D May 8, 2021, 2:40 a.m. OK GNU C++11 TESTS 63 264 24166400
115657058 Bucketsmith D May 8, 2021, 3:49 a.m. OK GNU C++11 TESTS 63 311 26624000
115637201 kritipandey D May 7, 2021, 8:29 p.m. OK GNU C++14 TESTS 63 202 10854400
115661350 buriXzura D May 8, 2021, 4:56 a.m. OK GNU C++14 TESTS 63 218 10854400
115620748 ajj D May 7, 2021, 5:35 p.m. OK GNU C++14 TESTS 63 234 10854400
115658221 wwl995 D May 8, 2021, 4:09 a.m. OK GNU C++14 TESTS 63 280 15872000
115637565 chthollist D May 7, 2021, 8:33 p.m. OK GNU C++14 TESTS 63 295 14848000
115646641 mtnshh D May 7, 2021, 11:43 p.m. OK GNU C++14 TESTS 63 296 15462400
115638122 chthollist D May 7, 2021, 8:41 p.m. OK GNU C++14 TESTS 63 311 14848000
115634589 Xzirium D May 7, 2021, 7:59 p.m. OK GNU C++14 TESTS 63 311 34508800
115633872 Reverent D May 7, 2021, 7:48 p.m. OK GNU C++14 TESTS 63 326 34508800
115628722 SupremeMasterFirstClass D May 7, 2021, 6:39 p.m. OK GNU C++14 TESTS 63 327 23347200
115656427 TrickFoxb D May 8, 2021, 3:37 a.m. OK GNU C++17 TESTS 63 186 12902400
115646337 mafailure D May 7, 2021, 11:31 p.m. OK GNU C++17 TESTS 63 186 13004800
115652065 Zain D May 8, 2021, 2:19 a.m. OK GNU C++17 TESTS 63 187 11366400
115647831 SundayJerry D May 8, 2021, 12:30 a.m. OK GNU C++17 TESTS 63 187 12492800
115624691 peti1234 D May 7, 2021, 5:59 p.m. OK GNU C++17 TESTS 63 202 12902400
115652927 Yzm007 D May 8, 2021, 2:36 a.m. OK GNU C++17 TESTS 63 202 18944000
115656074 zhanggengchen D May 8, 2021, 3:30 a.m. OK GNU C++17 TESTS 63 217 13107200
115654728 lrvideckis D May 8, 2021, 3:09 a.m. OK GNU C++17 TESTS 63 218 14438400
115625283 ThiagoMM D May 7, 2021, 6:04 p.m. OK GNU C++17 TESTS 63 233 10956800
115656069 200815147 D May 8, 2021, 3:30 a.m. OK GNU C++17 TESTS 63 233 11468800
115649961 LayCurse D May 8, 2021, 1:33 a.m. OK GNU C++17 (64) TESTS 63 78 107520000
115647835 aryanc403 D May 8, 2021, 12:30 a.m. OK GNU C++17 (64) TESTS 63 170 15155200
115628863 smax D May 7, 2021, 6:41 p.m. OK GNU C++17 (64) TESTS 63 186 12697600
115639389 Arrias D May 7, 2021, 9 p.m. OK GNU C++17 (64) TESTS 63 187 12595200
115666008 Jorge213 D May 8, 2021, 5:58 a.m. OK GNU C++17 (64) TESTS 63 187 13004800
115623522 Keep_Coding D May 7, 2021, 5:51 p.m. OK GNU C++17 (64) TESTS 63 202 16281600
115644194 yash_daga D May 7, 2021, 10:28 p.m. OK GNU C++17 (64) TESTS 63 202 17920000
115664157 TheIceKing D May 8, 2021, 5:34 a.m. OK GNU C++17 (64) TESTS 63 202 24576000
115659188 Lain D May 8, 2021, 4:25 a.m. OK GNU C++17 (64) TESTS 63 218 16588800
115645505 wassim.omais D May 7, 2021, 11 p.m. OK GNU C++17 (64) TESTS 63 218 29388800
115621897 0x3F D May 7, 2021, 5:40 p.m. OK Go TESTS 63 358 27033600
115639425 Dukkha D May 7, 2021, 9:01 p.m. OK Java 11 TESTS 63 966 31232000
115647442 Hakiobo D May 8, 2021, 12:15 a.m. OK Kotlin TESTS 63 561 70758400
115648087 Hakiobo D May 8, 2021, 12:38 a.m. OK Kotlin TESTS 63 576 70758400
115647500 Hakiobo D May 8, 2021, 12:17 a.m. OK Kotlin TESTS 63 577 70758400
115647238 Hakiobo D May 8, 2021, 12:08 a.m. OK Kotlin TESTS 63 577 70758400
115648255 Hakiobo D May 8, 2021, 12:44 a.m. OK Kotlin TESTS 63 592 70758400
115621916 r57shell D May 7, 2021, 5:40 p.m. OK MS C++ TESTS 63 187 12083200
115643252 grey D May 7, 2021, 10:07 p.m. OK MS C++ 2017 TESTS 63 1512 21401600
115638115 at_f D May 7, 2021, 8:41 p.m. OK PyPy 3 TESTS 63 1855 78028800
115631571 belkka D May 7, 2021, 7:15 p.m. OK PyPy 3 TESTS 63 2261 45772800
115621767 inszva D May 7, 2021, 5:39 p.m. OK PyPy 3 TESTS 63 2308 124211200
115657850 sh1194 D May 8, 2021, 4:03 a.m. OK Python 3 TESTS 63 2620 52019200
115657992 sh1194 D May 8, 2021, 4:05 a.m. OK Python 3 TESTS 63 2713 51712000

remove filters

Back to search problems