Codeforces Round 781 (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
1665 Codeforces Round 781 (Div. 2) FINISHED False 7200 87837863 April 8, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8548 ) C Tree Infection PROGRAMMING binary search dfs and similar greedy trees

B"A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a vertex v (different from root) is the previous to v vertex on the shortest path from the root to the vertex v . Children of the vertex v are all vertices for which v is the parent. You are given a rooted tree with n vertices. The vertex 1 is the root. Initially, all vertices are healthy. Each second you do two operations, the spreading operation and, after that, the injection operation: This process repeats each second until the whole tree is infected. You need to find the minimal number of seconds needed to infect the whole tree. The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of the vertices in the given tree. The second line of each test case contains n - 1 integers p_2, p_3, ldots, p_n ( 1 <= p_i <= n ), where p_i is the ancestor of the i -th vertex in the tree. It is guaranteed that the given graph is a tree. It is guaranteed that the sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case you should output a single integer -- the minimal number of seconds needed to infect the whole tree. The image depicts the tree from the first test case during each second. A vertex is black if it is not infected. A vertex is blue if it is infected by injection during the previous second. A vertex is green if it is infected by spreading during the previous second. A vertex is red if it is infected earlier than the previous second. Note that you are able to choose which vertices are infected by spreading and by injections. "...

Tutorials

Codeforces Round #781 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
153069864 rainboy C April 8, 2022, 4:27 p.m. OK GNU C11 TESTS 27 78 1638400
153114541 cunzai_zsy0531 C April 9, 2022, 5:40 a.m. OK GNU C++14 TESTS 27 31 3379200
153086373 apurv_goel C April 8, 2022, 7:12 p.m. OK GNU C++14 TESTS 27 46 2457600
153082968 Ampere2204 C April 8, 2022, 6:22 p.m. OK GNU C++14 TESTS 27 46 2457600
153078176 H111 C April 8, 2022, 5:30 p.m. OK GNU C++14 TESTS 27 46 2457600
153115461 dongdong01 C April 9, 2022, 5:52 a.m. OK GNU C++14 TESTS 27 46 2457600
153084616 daniyarello C April 8, 2022, 6:45 p.m. OK GNU C++14 TESTS 27 46 5632000
153078934 Jonothor_Darry C April 8, 2022, 5:37 p.m. OK GNU C++14 TESTS 27 46 6348800
153091704 MoJo. C April 8, 2022, 8:39 p.m. OK GNU C++14 TESTS 27 61 2457600
153083872 suraj.xd C April 8, 2022, 6:34 p.m. OK GNU C++14 TESTS 27 61 2457600
153076364 Husanboy C April 8, 2022, 5:15 p.m. OK GNU C++14 TESTS 27 61 2457600
153106052 -Samuel C April 9, 2022, 2:56 a.m. OK GNU C++17 TESTS 27 31 17612800
153115061 bgg0516 C April 9, 2022, 5:47 a.m. OK GNU C++17 TESTS 27 46 2457600
153074264 paula C April 8, 2022, 5:02 p.m. OK GNU C++17 TESTS 27 46 2457600
153089664 mubin_akib C April 8, 2022, 8:06 p.m. OK GNU C++17 TESTS 27 46 3174400
153078641 mohammadhs C April 8, 2022, 5:34 p.m. OK GNU C++17 TESTS 27 46 3174400
153106431 Guptaansh C April 9, 2022, 3:06 a.m. OK GNU C++17 TESTS 27 46 4812800
153083200 yazan_istatiyeh C April 8, 2022, 6:25 p.m. OK GNU C++17 TESTS 27 61 819200
153068807 younghanstark C April 8, 2022, 4:24 p.m. OK GNU C++17 TESTS 27 61 921600
153091480 NAHDI51 C April 8, 2022, 8:36 p.m. OK GNU C++17 TESTS 27 61 1638400
153114421 lovyamyppm C April 9, 2022, 5:38 a.m. OK GNU C++17 TESTS 27 61 2457600
153114213 mysteri0us7 C April 9, 2022, 5:36 a.m. OK GNU C++17 (64) TESTS 27 31 2969600
153077353 virt_contest_taker C April 8, 2022, 5:23 p.m. OK GNU C++17 (64) TESTS 27 46 819200
153097723 inksamurai C April 8, 2022, 10:58 p.m. OK GNU C++17 (64) TESTS 27 46 819200
153097331 inksamurai C April 8, 2022, 10:47 p.m. OK GNU C++17 (64) TESTS 27 46 819200
153092523 kal013 C April 8, 2022, 8:54 p.m. OK GNU C++17 (64) TESTS 27 46 819200
153081166 atanughosh01 C April 8, 2022, 6:01 p.m. OK GNU C++17 (64) TESTS 27 46 819200
153100861 GouenjiShuuya C April 9, 2022, 12:26 a.m. OK GNU C++17 (64) TESTS 27 46 1638400
153083596 Saimun_Islam C April 8, 2022, 6:31 p.m. OK GNU C++17 (64) TESTS 27 46 1638400
153106910 IzumiTomori C April 9, 2022, 3:17 a.m. OK GNU C++17 (64) TESTS 27 46 1638400
153082683 Saimun_Islam C April 8, 2022, 6:18 p.m. OK GNU C++17 (64) TESTS 27 46 1638400
153109816 apoorv_me C April 9, 2022, 4:19 a.m. OK GNU C++20 (64) TESTS 27 31 819200
153083036 ItsLastDay C April 8, 2022, 6:23 p.m. OK GNU C++20 (64) TESTS 27 31 819200
153076552 ScarletS C April 8, 2022, 5:16 p.m. OK GNU C++20 (64) TESTS 27 31 819200
153077651 TimeWarp101 C April 8, 2022, 5:25 p.m. OK GNU C++20 (64) TESTS 27 31 1638400
153112835 zywyshangan C April 9, 2022, 5:15 a.m. OK GNU C++20 (64) TESTS 27 31 2457600
153109753 rest_api C April 9, 2022, 4:18 a.m. OK GNU C++20 (64) TESTS 27 31 2457600
153083802 orazbaevDev C April 8, 2022, 6:33 p.m. OK GNU C++20 (64) TESTS 27 31 2457600
153083362 eriamruf C April 8, 2022, 6:27 p.m. OK GNU C++20 (64) TESTS 27 31 2969600
153112546 andif C April 9, 2022, 5:11 a.m. OK GNU C++20 (64) TESTS 27 31 2969600
153085403 rohan_singh_07 C April 8, 2022, 6:56 p.m. OK GNU C++20 (64) TESTS 27 31 2969600
153107720 018429 C April 9, 2022, 3:36 a.m. OK Go TESTS 27 186 9011200
153109139 __Serendipity C April 9, 2022, 4:05 a.m. OK Java 11 TESTS 27 234 0
153109145 Eslam_Ahmed C April 9, 2022, 4:06 a.m. OK Java 11 TESTS 27 249 0
153110454 prabhjout C April 9, 2022, 4:33 a.m. OK Java 11 TESTS 27 264 0
153081761 Lior C April 8, 2022, 6:07 p.m. OK Java 11 TESTS 27 265 0
153080900 Relief C April 8, 2022, 5:58 p.m. OK Java 11 TESTS 27 265 7680000
153108589 duyipeng C April 9, 2022, 3:55 a.m. OK Java 11 TESTS 27 265 8806400
153103434 Wuya C April 9, 2022, 1:45 a.m. OK Java 11 TESTS 27 265 10854400
153086027 danbanica C April 8, 2022, 7:07 p.m. OK Java 11 TESTS 27 280 0
153103042 anubhav44044 C April 9, 2022, 1:32 a.m. OK Java 11 TESTS 27 296 7475200
153085692 smlj C April 8, 2022, 7:01 p.m. OK Java 11 TESTS 27 311 5836800
153111275 Y_s_y_s C April 9, 2022, 4:49 a.m. OK Java 8 TESTS 27 187 3686400
153109986 Y_s_y_s C April 9, 2022, 4:23 a.m. OK Java 8 TESTS 27 202 3686400
153110940 Y_s_y_s C April 9, 2022, 4:43 a.m. OK Java 8 TESTS 27 202 3686400
153096297 Ah86543 C April 8, 2022, 10:15 p.m. OK Java 8 TESTS 27 218 5427200
153096319 AbdulazizHassan C April 8, 2022, 10:15 p.m. OK Java 8 TESTS 27 218 5427200
153088681 sachinjaiswal C April 8, 2022, 7:50 p.m. OK Java 8 TESTS 27 233 6860800
153095856 Ah86543 C April 8, 2022, 10:05 p.m. OK Java 8 TESTS 27 264 5529600
153112840 Ghost_Fox_Sledgehammer C April 9, 2022, 5:15 a.m. OK Java 8 TESTS 27 326 14438400
153074721 naveen4737 C April 8, 2022, 5:04 p.m. OK Java 8 TESTS 27 405 35328000
153085268 sourav_100 C April 8, 2022, 6:54 p.m. OK Java 8 TESTS 27 686 14540800
153080616 hanel1164 C April 8, 2022, 5:54 p.m. OK Kotlin 1.4 TESTS 27 186 6656000
153083345 darkl0rd C April 8, 2022, 6:27 p.m. OK Kotlin 1.5 TESTS 27 342 21094400
153074390 meinego C April 8, 2022, 5:02 p.m. OK Kotlin 1.6 TESTS 27 249 819200
153074544 meinego C April 8, 2022, 5:03 p.m. OK Kotlin 1.6 TESTS 27 343 819200
153066678 AIdancer C April 8, 2022, 4:17 p.m. OK MS C++ 2017 TESTS 27 124 6860800
153086677 KseniaShk C April 8, 2022, 7:17 p.m. OK MS C++ 2017 TESTS 27 156 6553600
153069217 Dakericy C April 8, 2022, 4:25 p.m. OK MS C++ 2017 TESTS 27 342 12288000
153065314 l12345678 C April 8, 2022, 4:13 p.m. OK MS C++ 2017 TESTS 27 343 6553600
153066985 artemijkurganov C April 8, 2022, 4:19 p.m. OK .NET Core C# TESTS 27 249 30310400
153106245 XYShaoKang C April 9, 2022, 3:01 a.m. OK Node.js TESTS 27 140 17510400
153105992 XYShaoKang C April 9, 2022, 2:55 a.m. OK Node.js TESTS 27 140 17612800
153104011 XYShaoKang C April 9, 2022, 2:04 a.m. OK Node.js TESTS 27 140 17612800
153109110 XYShaoKang C April 9, 2022, 4:05 a.m. OK Node.js TESTS 27 155 17510400
153106275 XYShaoKang C April 9, 2022, 3:02 a.m. OK Node.js TESTS 27 202 27852800
153106298 XYShaoKang C April 9, 2022, 3:02 a.m. OK Node.js TESTS 27 202 27955200
153094246 1_2_3_4_5_9 C April 8, 2022, 9:28 p.m. OK PyPy 2 TESTS 27 171 14233600
153094138 14_15_16 C April 8, 2022, 9:26 p.m. OK PyPy 2 TESTS 27 171 14233600
153077077 wizardrabbit C April 8, 2022, 5:21 p.m. OK PyPy 3 TESTS 27 249 18227200
153078911 brimstone C April 8, 2022, 5:37 p.m. OK PyPy 3 TESTS 27 264 19558400
153075786 Eguy C April 8, 2022, 5:11 p.m. OK PyPy 3 TESTS 27 280 22835200
153066201 sushmanth.dampur8780 C April 8, 2022, 4:16 p.m. OK PyPy 3 TESTS 27 327 19353600
153067775 lemiao12 C April 8, 2022, 4:21 p.m. OK PyPy 3 TESTS 27 327 25088000
153112668 legend.ary_as C April 9, 2022, 5:12 a.m. OK PyPy 3 TESTS 27 420 20582400
153080786 Believer_Ayush C April 8, 2022, 5:57 p.m. OK PyPy 3 TESTS 27 499 21913600
153100279 tan_delhi C April 9, 2022, 12:10 a.m. OK PyPy 3 TESTS 27 499 25907200
153106948 mnkqc C April 9, 2022, 3:18 a.m. OK PyPy 3 TESTS 27 514 23244800
153099957 unknownSolver C April 9, 2022, 12:02 a.m. OK PyPy 3-64 TESTS 27 202 24985600
153100133 unknownSolver C April 9, 2022, 12:06 a.m. OK PyPy 3-64 TESTS 27 202 25088000
153100086 unknownSolver C April 9, 2022, 12:05 a.m. OK PyPy 3-64 TESTS 27 202 25088000
153099700 unknownSolver C April 8, 2022, 11:55 p.m. OK PyPy 3-64 TESTS 27 202 25088000
153087273 beethoven97 C April 8, 2022, 7:27 p.m. OK PyPy 3-64 TESTS 27 217 20684800
153099712 unknownSolver C April 8, 2022, 11:56 p.m. OK PyPy 3-64 TESTS 27 217 24985600
153099935 unknownSolver C April 9, 2022, 12:01 a.m. OK PyPy 3-64 TESTS 27 218 25088000
153091319 RANK1ZEN C April 8, 2022, 8:33 p.m. OK PyPy 3-64 TESTS 27 233 26009600
153102136 MrVroom999 C April 9, 2022, 1:04 a.m. OK PyPy 3-64 TESTS 27 249 31641600
153115360 Ayushman_123 C April 9, 2022, 5:51 a.m. OK PyPy 3-64 TESTS 27 343 39219200
153068648 saturnhafen C April 8, 2022, 4:24 p.m. OK Python 3 TESTS 27 233 19660800
153079477 codingWhale C April 8, 2022, 5:43 p.m. OK Python 3 TESTS 27 280 19660800
153091185 0_Mr_MaTriX_0 C April 8, 2022, 8:31 p.m. OK Python 3 TESTS 27 296 12185600
153079515 codingWhale C April 8, 2022, 5:43 p.m. OK Python 3 TESTS 27 296 19660800
153074635 Mohamed2209 C April 8, 2022, 5:04 p.m. OK Python 3 TESTS 27 312 12185600
153074955 0_Mr_MaTriX_0 C April 8, 2022, 5:05 p.m. OK Python 3 TESTS 27 327 12185600
153078572 games.princeraj C April 8, 2022, 5:34 p.m. OK Python 3 TESTS 27 343 13926400
153111947 abhijeet.panihar.cse20 C April 9, 2022, 5:01 a.m. OK Python 3 TESTS 27 514 14131200
153075579 vasya.leonov2009 C April 8, 2022, 5:09 p.m. OK Python 3 TESTS 27 561 13926400
153086311 Bisquito C April 8, 2022, 7:11 p.m. OK Python 3 TESTS 27 592 16896000
153112360 RunGood C April 9, 2022, 5:08 a.m. OK Rust 2021 TESTS 27 61 10752000
153106903 bqn C April 9, 2022, 3:17 a.m. OK Rust 2021 TESTS 27 124 18944000

remove filters

Back to search problems