Codeforces Round 916 (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
1914 Codeforces Round 916 (Div. 3) FINISHED False 9000 34183463 Dec. 19, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4278 ) F Programming Competition PROGRAMMING dfs and similar greedy trees

B"BerSoft is the biggest IT corporation in Berland. There are n employees at BerSoft company, numbered from 1 to n . The first employee is the head of the company, and he does not have any superiors. Every other employee i has exactly one direct superior p_i . Employee x is considered to be a superior (direct or indirect) of employee y if one of the following conditions holds: The structure of BerSoft is organized in such a way that the head of the company is superior of every employee. A programming competition is going to be held soon. Two-person teams should be created for this purpose. However, if one employee in a team is the superior of another, they are uncomfortable together. So, teams of two people should be created so that no one is the superior of the other. Note that no employee can participate in more than one team. Your task is to calculate the maximum possible number of teams according to the aforementioned rules. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of employees. The second line contains n-1 integers p_2, p_3, ... , p_n ( 1 <= p_i <= n ), where p_i is the index of the direct superior of the i -th employee. The sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case, print a single integer -- the maximum possible number of teams according to the aforementioned rules. In the first test case, team (3, 4) can be created. In the second test case, no team can be created, because there are only 2 employees and one is the superior of another. In the third test case, team (2, 3) can be created. In the fourth test case, teams (2, 4) , (3, 5) and (6, 7) can be created. In the fifth test case, teams (2, 3) , (6, 4) and ("...

Tutorials

Codeforces Round 916 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
238095757 TopCloser F Dec. 20, 2023, 5:01 a.m. OK Clang++20 Diagnostics TESTS 44 1606 90009600
238097915 luogu_bot5 F Dec. 20, 2023, 5:27 a.m. OK GNU C++14 TESTS 44 78 14438400
238090550 Empty_Dust F Dec. 20, 2023, 3:43 a.m. OK GNU C++14 TESTS 44 78 41984000
238086558 Sky_walkerL F Dec. 20, 2023, 2:25 a.m. OK GNU C++14 TESTS 44 93 14438400
238085964 TJUHuangTao F Dec. 20, 2023, 2:12 a.m. OK GNU C++14 TESTS 44 93 16179200
238087366 RichardLau F Dec. 20, 2023, 2:42 a.m. OK GNU C++14 TESTS 44 93 18636800
238088198 NEERAJ2003 F Dec. 20, 2023, 3:01 a.m. OK GNU C++14 TESTS 44 93 20172800
238054086 Aqassem2004 F Dec. 19, 2023, 5:15 p.m. OK GNU C++14 TESTS 44 93 20172800
238094850 liaoz123 F Dec. 20, 2023, 4:48 a.m. OK GNU C++14 TESTS 44 93 28876800
238090660 Empty_Dust F Dec. 20, 2023, 3:44 a.m. OK GNU C++14 TESTS 44 93 41984000
238095491 tahoangquan2 F Dec. 20, 2023, 4:57 a.m. OK GNU C++14 TESTS 44 108 14540800
238084452 shiye0803 F Dec. 20, 2023, 1:35 a.m. OK GNU C++17 TESTS 44 78 18636800
238075508 Pakpim F Dec. 19, 2023, 9:08 p.m. OK GNU C++17 TESTS 44 78 20172800
238078330 Fast_submit F Dec. 19, 2023, 10:16 p.m. OK GNU C++17 TESTS 44 78 20172800
238062785 REMAINDoER F Dec. 19, 2023, 6:18 p.m. OK GNU C++17 TESTS 44 93 10444800
238091780 jiangzhihui F Dec. 20, 2023, 4:02 a.m. OK GNU C++17 TESTS 44 93 11980800
238060113 buihoatchuyenhv F Dec. 19, 2023, 5:55 p.m. OK GNU C++17 TESTS 44 93 12492800
238073788 Pavlot F Dec. 19, 2023, 8:35 p.m. OK GNU C++17 TESTS 44 93 15360000
238093544 Radiaa F Dec. 20, 2023, 4:28 a.m. OK GNU C++17 TESTS 44 93 16179200
238056332 pmmitkovv F Dec. 19, 2023, 5:28 p.m. OK GNU C++17 TESTS 44 93 16998400
238056277 pmitkov F Dec. 19, 2023, 5:27 p.m. OK GNU C++17 TESTS 44 93 16998400
238086370 xu826281112 F Dec. 20, 2023, 2:21 a.m. OK GNU C++17 (64) TESTS 44 31 25804800
238095466 hatsuyufei F Dec. 20, 2023, 4:57 a.m. OK GNU C++17 (64) TESTS 44 77 32051200
238052544 ggmxwg F Dec. 19, 2023, 5:08 p.m. OK GNU C++17 (64) TESTS 44 78 11673600
238098549 hchchc F Dec. 20, 2023, 5:35 a.m. OK GNU C++17 (64) TESTS 44 78 29696000
238053480 lxy__ F Dec. 19, 2023, 5:12 p.m. OK GNU C++17 (64) TESTS 44 93 13926400
238095652 old_wrp F Dec. 20, 2023, 4:59 a.m. OK GNU C++17 (64) TESTS 44 93 24064000
238050109 wrzesinskimikolaj2006 F Dec. 19, 2023, 5:02 p.m. OK GNU C++17 (64) TESTS 44 93 24883200
238093234 zime_www F Dec. 20, 2023, 4:24 a.m. OK GNU C++17 (64) TESTS 44 93 24883200
238078747 enslaved F Dec. 19, 2023, 10:27 p.m. OK GNU C++17 (64) TESTS 44 93 27238400
238085608 Mkbk_program_learn F Dec. 20, 2023, 2:03 a.m. OK GNU C++17 (64) TESTS 44 93 33689600
238086782 Jorge_slime F Dec. 20, 2023, 2:30 a.m. OK GNU C++20 (64) TESTS 44 46 2457600
238056809 vinhdangquoc729 F Dec. 19, 2023, 5:31 p.m. OK GNU C++20 (64) TESTS 44 46 4915200
238064837 yumkam F Dec. 19, 2023, 6:39 p.m. OK GNU C++20 (64) TESTS 44 62 28057600
238075339 takeuchi-masaki F Dec. 19, 2023, 9:04 p.m. OK GNU C++20 (64) TESTS 44 62 28876800
238085465 yyytf__ F Dec. 20, 2023, 2 a.m. OK GNU C++20 (64) TESTS 44 77 16691200
238080455 Mohamed-Flash F Dec. 19, 2023, 11:23 p.m. OK GNU C++20 (64) TESTS 44 78 14848000
238072603 RHEXAOC F Dec. 19, 2023, 8:17 p.m. OK GNU C++20 (64) TESTS 44 78 16076800
238047983 fallleaves07 F Dec. 19, 2023, 4:57 p.m. OK GNU C++20 (64) TESTS 44 78 16281600
238090169 hungeazy F Dec. 20, 2023, 3:36 a.m. OK GNU C++20 (64) TESTS 44 78 16486400
238082065 Anonymely F Dec. 20, 2023, 12:24 a.m. OK GNU C++20 (64) TESTS 44 78 16691200
238099934 123_wby F Dec. 20, 2023, 5:52 a.m. OK Go TESTS 44 186 78540800
238099089 snkv F Dec. 20, 2023, 5:42 a.m. OK Java 11 TESTS 44 795 128409600
238059579 2100032209 F Dec. 19, 2023, 5:50 p.m. OK Java 11 TESTS 44 935 182374400
238060163 skylord69 F Dec. 19, 2023, 5:56 p.m. OK Java 17 TESTS 44 998 77004800
238070277 Samyajit125 F Dec. 19, 2023, 7:44 p.m. OK Java 21 TESTS 44 810 97484800
238085982 NerfThis F Dec. 20, 2023, 2:13 a.m. OK Java 8 TESTS 44 514 40755200
238047164 igor_kz F Dec. 19, 2023, 4:55 p.m. OK Java 8 TESTS 44 1262 101478400
238090129 v2110030321 F Dec. 20, 2023, 3:35 a.m. OK PyPy 3 TESTS 44 451 23961600
238081004 porker2008 F Dec. 19, 2023, 11:43 p.m. OK PyPy 3 TESTS 44 499 40038400
238088754 Bhanu_304 F Dec. 20, 2023, 3:11 a.m. OK PyPy 3-64 TESTS 44 264 32972800
238049460 RobinFromTheHood F Dec. 19, 2023, 5 p.m. OK PyPy 3-64 TESTS 44 265 43827200
238055828 yuki_keshiki F Dec. 19, 2023, 5:25 p.m. OK PyPy 3-64 TESTS 44 280 32972800
238080009 EvGen1u5 F Dec. 19, 2023, 11:08 p.m. OK PyPy 3-64 TESTS 44 374 38707200
238049259 cy171 F Dec. 19, 2023, 5 p.m. OK PyPy 3-64 TESTS 44 514 60518400
238049976 blue_ice_yj F Dec. 19, 2023, 5:01 p.m. OK PyPy 3-64 TESTS 44 545 60825600
238083998 oweijane F Dec. 20, 2023, 1:22 a.m. OK PyPy 3-64 TESTS 44 701 156569600
238056812 AS2905 F Dec. 19, 2023, 5:31 p.m. OK PyPy 3-64 TESTS 44 1185 59084800
238046899 andrei_rc F Dec. 19, 2023, 4:55 p.m. OK PyPy 3-64 TESTS 44 1294 50790400
238073374 liut F Dec. 19, 2023, 8:29 p.m. OK Rust 2021 TESTS 44 139 19660800
238069047 _a253 F Dec. 19, 2023, 7:27 p.m. OK Rust 2021 TESTS 44 140 88064000
238069186 _a253 F Dec. 19, 2023, 7:29 p.m. OK Rust 2021 TESTS 44 171 84787200

remove filters

Back to search problems