Codeforces Round 549 (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
1143 Codeforces Round 549 (Div. 2) FINISHED False 7200 177857399 March 30, 2019, 5:10 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12698 ) C Queen PROGRAMMING dfs and similar trees 1400

B'You are given a rooted tree with vertices numerated from 1 to n . A tree is a connected graph without cycles. A rooted tree has a special vertex named root. Ancestors of the vertex i are all vertices on the path from the root to the vertex i , except the vertex i itself. The parent of the vertex i is the nearest to the vertex i ancestor of i . Each vertex is a child of its parent. In the given tree the parent of the vertex i is the vertex p_i . For the root, the value p_i is -1 . You noticed that some vertices do not respect others. In particular, if c_i = 1 , then the vertex i does not respect any of its ancestors, and if c_i = 0 , it respects all of them. You decided to delete vertices from the tree one by one. On each step you select such a non-root vertex that it does not respect its parent and none of its children respects it. If there are several such vertices, you select the one with the smallest number. When you delete this vertex v , all children of v become connected with the parent of v . Once there are no vertices matching the criteria for deletion, you stop the process. Print the order in which you will delete the vertices. Note that this order is unique. The first line contains a single integer n ( 1 <= n <= 10^5 ) -- the number of vertices in the tree. The next n lines describe the tree: the i -th line contains two integers p_i and c_i ( 1 <= p_i <= n , 0 <= c_i <= 1 ), where p_i is the parent of the vertex i , and c_i = 0 , if the vertex i respects its parents, and c_i = 1 , if the vertex i does not respect any of its parents. The root of the tree has -1 instead of the parent index, also, c_i=0 for the root. It is guaranteed that the values p_i define a rooted tree with n vertices. In case there is at least one vertex to delete, print the'...

Tutorials

Codeforces Round #549 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
52041818 avm C March 30, 2019, 5:55 p.m. OK D TESTS 34 46 25292800 1400
52048607 cedretaber C March 30, 2019, 6:32 p.m. OK D TESTS 34 187 24064000 1400
52041720 ruban C March 30, 2019, 5:54 p.m. OK Delphi TESTS 34 77 225996800 1400
52892197 omlgg C April 17, 2019, 8:23 a.m. OK FPC TESTS 34 296 1536000 1400
52043095 EgorShibaev C March 30, 2019, 6:01 p.m. OK FPC TESTS 34 326 1228800 1400
52048101 PAG C March 30, 2019, 6:29 p.m. OK FPC TESTS 34 343 614400 1400
52046451 Ngohavi C March 30, 2019, 6:19 p.m. OK FPC TESTS 34 358 22425600 1400
52063583 sansen C March 31, 2019, 3:34 a.m. OK GNU C11 TESTS 34 31 1228800 1400
53016727 Naii_the_Baf C April 19, 2019, 2:30 p.m. OK GNU C11 TESTS 34 358 409600 1400
52041786 Risen_Again C March 30, 2019, 5:55 p.m. OK GNU C11 TESTS 34 358 1638400 1400
62738483 abcd227 C Oct. 16, 2019, 7:01 p.m. OK GNU C11 TESTS 34 358 2355200 1400
52036274 hwergelmir C March 30, 2019, 5:31 p.m. OK GNU C11 TESTS 34 374 409600 1400
53889422 oscer C May 8, 2019, 9:39 p.m. OK GNU C11 TESTS 34 655 1228800 1400
52080390 symbioticstar sbw sky666 C March 31, 2019, 11:57 a.m. OK GNU C++11 TESTS 34 31 819200 1400
55118267 Umi C June 5, 2019, 9:44 a.m. OK GNU C++11 TESTS 34 31 4608000 1400
52217086 Minamoto C April 2, 2019, 3:06 a.m. OK GNU C++11 TESTS 34 31 9420800 1400
52070648 IdeaSeeker C March 31, 2019, 7:39 a.m. OK GNU C++11 TESTS 34 46 0 1400
55492331 luogu_bot2 C June 12, 2019, 10:43 a.m. OK GNU C++11 TESTS 34 46 0 1400
55488470 wucstdio C June 12, 2019, 9 a.m. OK GNU C++11 TESTS 34 46 0 1400
53004769 vjudge1 C April 19, 2019, 9:01 a.m. OK GNU C++11 TESTS 34 46 204800 1400
52293499 vjudge4 C April 4, 2019, 4:26 a.m. OK GNU C++11 TESTS 34 46 614400 1400
52594379 vjudge4 C April 11, 2019, 8:01 a.m. OK GNU C++11 TESTS 34 46 819200 1400
55610402 ReaLNero1 C June 16, 2019, 5:18 a.m. OK GNU C++11 TESTS 34 46 819200 1400
52293666 vjudge5 C April 4, 2019, 4:37 a.m. OK GNU C++14 TESTS 34 46 102400 1400
52230585 Eassion_C C April 2, 2019, 11:45 a.m. OK GNU C++14 TESTS 34 46 3481600 1400
52045012 _Karuna C March 30, 2019, 6:11 p.m. OK GNU C++14 TESTS 34 61 102400 1400
52648901 M.Amangeldi C April 12, 2019, 3:42 p.m. OK GNU C++14 TESTS 34 61 102400 1400
52311383 1726tgyeuva C April 4, 2019, 2:47 p.m. OK GNU C++14 TESTS 34 61 4403200 1400
61846415 I_am_insane C Oct. 4, 2019, 11:27 a.m. OK GNU C++14 TESTS 34 62 0 1400
68416859 siddhant1 C Jan. 8, 2020, 7:19 p.m. OK GNU C++14 TESTS 34 62 0 1400
57917080 opsopsops1 C July 29, 2019, 2:10 a.m. OK GNU C++14 TESTS 34 62 0 1400
53849478 bhargav_0085 C May 7, 2019, 12:45 p.m. OK GNU C++14 TESTS 34 62 0 1400
52073435 blackstone1 C March 31, 2019, 8:53 a.m. OK GNU C++14 TESTS 34 62 0 1400
52743118 .tx C April 14, 2019, 10:13 a.m. OK GNU C++17 TESTS 34 46 3174400 1400
52038726 kessido C March 30, 2019, 5:41 p.m. OK GNU C++17 TESTS 34 46 3481600 1400
52495922 SDNU_LuoXinC C April 8, 2019, 1:41 p.m. OK GNU C++17 TESTS 34 61 409600 1400
53215264 pureZer C April 24, 2019, 8:25 a.m. OK GNU C++17 TESTS 34 61 1536000 1400
54981131 xucanxx C June 2, 2019, 1:13 p.m. OK GNU C++17 TESTS 34 61 1945600 1400
52638255 2017111799yjl C April 12, 2019, 11:16 a.m. OK GNU C++17 TESTS 34 61 2252800 1400
53667602 coolbuddy C May 2, 2019, 11:25 a.m. OK GNU C++17 TESTS 34 62 0 1400
52062745 dchy2000 C March 31, 2019, 2:53 a.m. OK GNU C++17 TESTS 34 62 0 1400
52062649 dchy2000 C March 31, 2019, 2:47 a.m. OK GNU C++17 TESTS 34 62 0 1400
52716969 Silvernguyen C April 13, 2019, 5:48 p.m. OK GNU C++17 TESTS 34 62 102400 1400
60354623 sighduck C Sept. 10, 2019, 3:38 p.m. OK Go TESTS 34 139 4505600 1400
52046651 avtobus C March 30, 2019, 6:20 p.m. OK Go TESTS 34 140 0 1400
52037250 caidodo0_0 C March 30, 2019, 5:35 p.m. OK Go TESTS 34 155 4505600 1400
52217375 2008061626 C April 2, 2019, 3:26 a.m. OK Go TESTS 34 530 5222400 1400
52085022 aman28rwt C March 31, 2019, 1:58 p.m. OK Java 8 TESTS 34 139 0 1400
52064555 amolpratap007 C March 31, 2019, 4:24 a.m. OK Java 8 TESTS 34 139 0 1400
52064534 _codophobia_ C March 31, 2019, 4:24 a.m. OK Java 8 TESTS 34 139 0 1400
52043945 weird_penguin C March 30, 2019, 6:05 p.m. OK Java 8 TESTS 34 139 0 1400
52084911 aman28rwt C March 31, 2019, 1:55 p.m. OK Java 8 TESTS 34 140 0 1400
57937205 garnacha C July 29, 2019, 11:15 a.m. OK Java 8 TESTS 34 155 0 1400
52311096 MubtasimShahriar C April 4, 2019, 2:40 p.m. OK Java 8 TESTS 34 155 0 1400
52289420 nopre C April 3, 2019, 11:14 p.m. OK Java 8 TESTS 34 155 0 1400
52065680 Java C March 31, 2019, 5:15 a.m. OK Java 8 TESTS 34 155 0 1400
52042706 Tarun C March 30, 2019, 5:59 p.m. OK Java 8 TESTS 34 155 0 1400
52945853 Lishy2010 C April 18, 2019, 11:31 a.m. OK Kotlin TESTS 34 327 12902400 1400
52061346 alykov C March 31, 2019, 1:24 a.m. OK Kotlin TESTS 34 498 204800 1400
52061327 alykov C March 31, 2019, 1:23 a.m. OK Kotlin TESTS 34 499 819200 1400
53126110 wbars C April 22, 2019, 2:05 p.m. OK Kotlin TESTS 34 654 40960000 1400
56061081 og.kostya C June 26, 2019, 5:30 a.m. OK Mono C# TESTS 34 93 9420800 1400
52047509 kkuehner C March 30, 2019, 6:26 p.m. OK Mono C# TESTS 34 109 5529600 1400
55332512 m1_k3 C June 9, 2019, 11:50 a.m. OK Mono C# TESTS 34 109 9113600 1400
66814652 hibatibati C Dec. 14, 2019, 5:06 a.m. OK Mono C# TESTS 34 155 8499200 1400
52041002 omikad C March 30, 2019, 5:51 p.m. OK Mono C# TESTS 34 233 19763200 1400
52309023 LapsleyJuno lewasupaman SaurumanS C April 4, 2019, 1:44 p.m. OK Mono C# TESTS 34 389 5120000 1400
52070419 eki C March 31, 2019, 7:33 a.m. OK Mono C# TESTS 34 390 5120000 1400
52048909 sergmel C March 30, 2019, 6:34 p.m. OK Mono C# TESTS 34 514 16384000 1400
52430035 nastya1199 C April 6, 2019, 9:50 p.m. OK Mono C# TESTS 34 514 20172800 1400
52571749 vjudge1 C April 10, 2019, 2:28 p.m. OK MS C++ TESTS 34 46 409600 1400
64319023 vjudge3 C Nov. 5, 2019, 3:01 p.m. OK MS C++ TESTS 34 46 409600 1400
64310628 vjudge2 C Nov. 5, 2019, 12:39 p.m. OK MS C++ TESTS 34 46 1843200 1400
52294249 vjudge3 C April 4, 2019, 5:05 a.m. OK MS C++ TESTS 34 46 2048000 1400
64612396 vjudge3 C Nov. 10, 2019, 2:35 a.m. OK MS C++ TESTS 34 61 409600 1400
63301934 vjudge3 C Oct. 24, 2019, 2:32 p.m. OK MS C++ TESTS 34 61 409600 1400
63234383 vjudge1 C Oct. 23, 2019, 11:54 a.m. OK MS C++ TESTS 34 61 409600 1400
52569369 vjudge2 C April 10, 2019, 1:38 p.m. OK MS C++ TESTS 34 61 409600 1400
63295661 vjudge1 C Oct. 24, 2019, 12:55 p.m. OK MS C++ TESTS 34 61 614400 1400
53703565 vjudge3 C May 3, 2019, 11:59 a.m. OK MS C++ TESTS 34 61 1228800 1400
53291604 TOXait C April 25, 2019, 3:53 p.m. OK MS C++ 2017 TESTS 34 77 819200 1400
52043058 GiraffeJ C March 30, 2019, 6:01 p.m. OK MS C++ 2017 TESTS 34 93 819200 1400
58389364 vjudge2 C Aug. 6, 2019, 1:07 p.m. OK MS C++ 2017 TESTS 34 93 1228800 1400
52234103 R99 C April 2, 2019, 1:05 p.m. OK MS C++ 2017 TESTS 34 108 4096000 1400
52048212 risa243 C March 30, 2019, 6:30 p.m. OK MS C++ 2017 TESTS 34 109 3276800 1400
52046657 AsahiKokura C March 30, 2019, 6:20 p.m. OK MS C++ 2017 TESTS 34 109 3788800 1400
52081692 hwangganzi C March 31, 2019, 12:27 p.m. OK MS C++ 2017 TESTS 34 109 3993600 1400
52047668 SugarOnBacon C March 30, 2019, 6:26 p.m. OK MS C++ 2017 TESTS 34 109 5939200 1400
52052820 swomack C March 30, 2019, 7:01 p.m. OK MS C++ 2017 TESTS 34 109 6144000 1400
52042053 youx C March 30, 2019, 5:56 p.m. OK MS C++ 2017 TESTS 34 109 6758400 1400
52068709 aeloud C March 31, 2019, 6:49 a.m. OK Node.js TESTS 34 342 28467200 1400
52044340 rsFalse C March 30, 2019, 6:07 p.m. OK Perl TESTS 34 717 63180800 1400
52311805 Mukundan314 C April 4, 2019, 2:59 p.m. OK PyPy 2 TESTS 34 217 13824000 1400
52039314 YESMAths C March 30, 2019, 5:44 p.m. OK PyPy 2 TESTS 34 327 16588800 1400
52358561 gatsko C April 5, 2019, 6:14 p.m. OK PyPy 2 TESTS 34 358 29798400 1400
52035178 frederika C March 30, 2019, 5:26 p.m. OK PyPy 2 TESTS 34 420 14540800 1400
59705582 vjudge5 C Aug. 30, 2019, 12:31 p.m. OK PyPy 2 TESTS 34 732 14131200 1400
52050395 supachai_pay C March 30, 2019, 6:45 p.m. OK PyPy 2 TESTS 34 733 13824000 1400
52043445 pa.n.ik C March 30, 2019, 6:03 p.m. OK PyPy 2 TESTS 34 998 20787200 1400
52080532 c1729 C March 31, 2019, noon OK PyPy 3 TESTS 34 233 13312000 1400
52132019 Leendertz C March 31, 2019, 9:23 p.m. OK PyPy 3 TESTS 34 234 8499200 1400
53830932 chaudhary_19 C May 6, 2019, 7:57 p.m. OK PyPy 3 TESTS 34 249 12902400 1400
52081551 c1729 C March 31, 2019, 12:24 p.m. OK PyPy 3 TESTS 34 249 13004800 1400
52131537 Leendertz C March 31, 2019, 8:56 p.m. OK PyPy 3 TESTS 34 249 17510400 1400
52041708 CHelle C March 30, 2019, 5:54 p.m. OK PyPy 3 TESTS 34 264 12288000 1400
52131594 Leendertz C March 31, 2019, 9 p.m. OK PyPy 3 TESTS 34 264 18432000 1400
55476329 Pedantic C June 12, 2019, 12:13 a.m. OK PyPy 3 TESTS 34 280 10649600 1400
52040851 c1729 C March 30, 2019, 5:50 p.m. OK PyPy 3 TESTS 34 280 13209600 1400
52043264 pineriver C March 30, 2019, 6:02 p.m. OK PyPy 3 TESTS 34 295 10547200 1400
52123698 Skand C March 31, 2019, 4:40 p.m. OK Python 2 TESTS 34 374 5017600 1400
52271415 Uranux C April 3, 2019, 1:16 p.m. OK Python 2 TESTS 34 389 6144000 1400
55953425 anshuman16423 C June 23, 2019, 5:17 a.m. OK Python 2 TESTS 34 405 512000 1400
52292133 nealzane C April 4, 2019, 2:59 a.m. OK Python 2 TESTS 34 420 9011200 1400
52040359 Nika86 C March 30, 2019, 5:48 p.m. OK Python 2 TESTS 34 421 2457600 1400
52056039 angoncal C March 30, 2019, 8:04 p.m. OK Python 2 TESTS 34 452 16896000 1400
52145907 aniket11 C April 1, 2019, 9:19 a.m. OK Python 2 TESTS 34 670 29798400 1400
53384504 ayejayys C April 27, 2019, 2:33 a.m. OK Python 3 TESTS 34 343 8704000 1400
52053542 katte.kurach C March 30, 2019, 7:05 p.m. OK Python 3 TESTS 34 358 5836800 1400
52044682 kantohm11 C March 30, 2019, 6:09 p.m. OK Python 3 TESTS 34 358 7270400 1400
52585219 spOoky C April 10, 2019, 10:54 p.m. OK Python 3 TESTS 34 358 7577600 1400
54995427 jokkebk C June 2, 2019, 10:45 p.m. OK Python 3 TESTS 34 358 7782400 1400
52039784 kinte C March 30, 2019, 5:46 p.m. OK Python 3 TESTS 34 373 8294400 1400
52062565 iehn C March 31, 2019, 2:41 a.m. OK Python 3 TESTS 34 373 11980800 1400
52131583 Leendertz C March 31, 2019, 8:59 p.m. OK Python 3 TESTS 34 374 18329600 1400
52131589 Leendertz C March 31, 2019, 9 p.m. OK Python 3 TESTS 34 374 21299200 1400
52471099 foreyes_1002 C April 7, 2019, 6:37 p.m. OK Python 3 TESTS 34 404 8396800 1400
64345846 chinmaykousik1 C Nov. 6, 2019, 6:13 a.m. OK Rust TESTS 34 93 4403200 1400
52321939 zakharvoit C April 4, 2019, 8:21 p.m. OK Rust TESTS 34 139 7577600 1400
52234637 yakamoto C April 2, 2019, 1:17 p.m. OK Scala TESTS 34 623 26214400 1400
52046075 old_boo C March 30, 2019, 6:17 p.m. OK Scala TESTS 34 936 0 1400

remove filters

Back to search problems