Codeforces Round 831 (Div. 1 + 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
1740 Codeforces Round 831 (Div. 1 + Div. 2) FINISHED False 9900 70145363 Oct. 29, 2022, 9:10 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 240 ) H MEX Tree Manipulation PROGRAMMING data structures trees 3300

B'Given a rooted tree, define the value of vertex u in the tree recursively as the MEX ^ dagger of the values of its children. Note that it is only the children, not all of its descendants. In particular, the value of a leaf is 0 . Pak Chanek has a rooted tree that initially only contains a single vertex with index 1 , which is the root. Pak Chanek is going to do q queries. In the i -th query, Pak Chanek is given an integer x_i . Pak Chanek needs to add a new vertex with index i+1 as the child of vertex x_i . After adding the new vertex, Pak Chanek needs to recalculate the values of all vertices and report the sum of the values of all vertices in the current tree. ^ dagger The MEX (minimum excluded) of an array is the smallest non-negative integer that does not belong to the array. For example, the MEX of [0,1,1,2,6,7] is 3 and the MEX of [6,9] is 0 . The first line contains a single integer q ( 1 <= q <= 3 cdot 10^5 ) -- the number of operations. Each of the next q lines contains a single integer x_i ( 1 <= q x_i <= q i ) -- the description of the i -th query. For each query, print a line containing an integer representing the sum of the new values of all vertices in the tree after adding the vertex. In the first example, the tree after the 6 -th query will look like this. The sum of the values of all vertices is 0+0+1+0+1+2+0=4 . '...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
178394159 Isonan H Oct. 29, 2022, 11:52 a.m. OK GNU C++14 TESTS 84 1434 112947200 3300
178405718 Um_nik H Oct. 29, 2022, 1:17 p.m. OK GNU C++17 TESTS 84 2121 93900800 3300
178430839 Savelij H Oct. 29, 2022, 4:38 p.m. OK GNU C++17 TESTS 84 4695 247091200 3300
178393380 ugly2333 H Oct. 29, 2022, 11:49 a.m. OK GNU C++17 TESTS 84 4820 247091200 3300
178452120 Benq H Oct. 29, 2022, 8:20 p.m. OK GNU C++17 (64) TESTS 84 608 97382400 3300
178441362 teapotd H Oct. 29, 2022, 6:19 p.m. OK GNU C++17 (64) TESTS 84 2012 103526400 3300
178461571 MiracleFaFa H Oct. 30, 2022, 12:36 a.m. OK GNU C++17 (64) TESTS 84 2901 141312000 3300
178448938 Radewoosh H Oct. 29, 2022, 7:51 p.m. OK GNU C++17 (64) TESTS 84 3556 425267200 3300
178389787 never_giveup H Oct. 29, 2022, 11:38 a.m. OK GNU C++20 (64) TESTS 84 483 109977600 3300
178449619 Aaeria H Oct. 29, 2022, 8 p.m. OK GNU C++20 (64) TESTS 84 686 133017600 3300
178449499 Aaeria H Oct. 29, 2022, 7:59 p.m. OK GNU C++20 (64) TESTS 84 717 124313600 3300
178389839 heno239 H Oct. 29, 2022, 11:38 a.m. OK GNU C++20 (64) TESTS 84 810 215449600 3300
178473578 Endagorion H Oct. 30, 2022, 5:47 a.m. OK GNU C++20 (64) TESTS 84 2230 107827200 3300
178398337 jeroenodb H Oct. 29, 2022, 12:34 p.m. OK GNU C++20 (64) TESTS 84 2324 168345600 3300
178416254 Gary2005 H Oct. 29, 2022, 2:37 p.m. OK GNU C++20 (64) TESTS 84 4601 287948800 3300
178400994 Maksim1744 H Oct. 29, 2022, 12:44 p.m. OK GNU C++20 (64) TESTS 84 4867 59596800 3300
178398982 Tlatoani H Oct. 29, 2022, 12:37 p.m. OK Kotlin 1.6 TESTS 84 3134 187494400 3300

remove filters

Back to search problems