Technocup 2022 - Elimination Round 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
1585 Technocup 2022 - Elimination Round 3 FINISHED False 7200 97857863 Dec. 12, 2021, 3:15 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1084 ) E Frequency Queries PROGRAMMING data structures dfs and similar trees

B"Petya has a rooted tree with an integer written on each vertex. The vertex 1 is the root. You are to answer some questions about the tree. A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a node v is the next vertex on the shortest path from v to the root. Each question is defined by three integers v , l , and k . To get the answer to the question, you need to perform the following steps: For example, if the sequence of integers on the path from v to the root is [2, 2, 1, 7, 1, 1, 4, 4, 4, 4] , l = 2 and k = 2 , then the answer is 1 . Please answer all questions about the tree. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 10^6 ). Description of the test cases follows. The first line of each test case contains two integers n , q ( 1 <= q n, q <= q 10^6 ) -- the number of vertices in the tree and the number of questions. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q n ), where a_i is the number written on the i -th vertex. The third line contains n-1 integers p_2, p_3, ldots, p_n ( 1 <= q p_i <= q n ), where p_i is the parent of node i . It's guaranteed that the values p define a correct tree. Each of the next q lines contains three integers v , l , k ( 1 <= q v, l, k <= q n ) -- descriptions of questions. It is guaranteed that the sum of n and the sum of q over all test cases do not exceed 10^6 . For each question of each test case print the answer to the question. In case of multiple answers, print any. "...

Tutorials

Codeforces Round #759 (Div. 2, based on Technocup 2022 Elimination Round 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
138979228 CHENRUIJIE E Dec. 13, 2021, 11:55 a.m. OK GNU C++14 TESTS 37 3775 249139200
138919587 CalisthenicsMan E Dec. 12, 2021, 5:06 p.m. OK GNU C++14 TESTS 34 3883 248217600
139034402 ynsm E Dec. 14, 2021, 2:07 a.m. OK GNU C++17 TESTS 37 2105 147968000
139016955 Wailydest E Dec. 13, 2021, 6:40 p.m. OK GNU C++17 TESTS 37 2823 228454400
138907906 princebelkovetz E Dec. 12, 2021, 4:28 p.m. OK GNU C++17 TESTS 34 3728 195993600
138911388 LeoPro E Dec. 12, 2021, 4:39 p.m. OK GNU C++17 TESTS 34 3962 356556800
138978953 vonat1us E Dec. 13, 2021, 11:52 a.m. OK GNU C++17 (64) TESTS 37 2932 424038400
138975300 BaluconisTima E Dec. 13, 2021, 11:12 a.m. OK GNU C++17 (64) TESTS 37 3494 305766400
138985647 Malheiros E Dec. 13, 2021, 12:58 p.m. OK GNU C++17 (64) TESTS 37 3790 329932800
139021144 Deepesson E Dec. 13, 2021, 7:42 p.m. OK GNU C++20 (64) TESTS 37 2807 249446400
139012506 AndreyPavlov E Dec. 13, 2021, 5:43 p.m. OK GNU C++20 (64) TESTS 37 3306 329113600
138919101 efimov04 E Dec. 12, 2021, 5:05 p.m. OK GNU C++20 (64) TESTS 34 3462 275456000
138900566 OGDanek_orz E Dec. 12, 2021, 4:10 p.m. OK GNU C++20 (64) TESTS 34 3837 311808000
139051806 Spheniscine E Dec. 14, 2021, 5:34 a.m. OK Rust 2021 TESTS 37 1357 238284800

remove filters

Back to search problems