Codeforces Round 759 (Div. 2, based on 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
1591 Codeforces Round 759 (Div. 2, based on Technocup 2022 Elimination Round 3) FINISHED False 7200 97944263 Dec. 12, 2021, 3:15 p.m.

Problems

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

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
138931077 rainboy E Dec. 12, 2021, 7:02 p.m. OK GNU C++14 TESTS 37 1544 69120000
138946433 kobietYEU E Dec. 13, 2021, 3:18 a.m. OK GNU C++14 TESTS 37 1949 167936000
138952623 XyzL E Dec. 13, 2021, 5:40 a.m. OK GNU C++14 TESTS 37 2167 217088000
138946205 ACOIer E Dec. 13, 2021, 3:11 a.m. OK GNU C++14 TESTS 37 2448 167936000
138944772 nguot E Dec. 13, 2021, 2:20 a.m. OK GNU C++14 TESTS 37 2839 205209600
138921206 lichenxi_114514 E Dec. 12, 2021, 5:11 p.m. OK GNU C++14 TESTS 34 2901 248422400
138918613 fftea E Dec. 12, 2021, 5:03 p.m. OK GNU C++14 TESTS 34 2932 384512000
138926860 Mari000 E Dec. 12, 2021, 6:07 p.m. OK GNU C++14 TESTS 34 3197 192000000
138926952 timpo E Dec. 12, 2021, 6:08 p.m. OK GNU C++14 TESTS 34 3306 207564800
138931315 Ebiarat E Dec. 12, 2021, 7:06 p.m. OK GNU C++14 TESTS 37 3306 221184000
138931064 rainboy E Dec. 12, 2021, 7:02 p.m. OK GNU C++17 TESTS 37 1513 69120000
138931401 ikaurov E Dec. 12, 2021, 7:08 p.m. OK GNU C++17 TESTS 37 1902 184012800
138936063 frangl E Dec. 12, 2021, 8:38 p.m. OK GNU C++17 TESTS 37 1903 184012800
138936022 frangl E Dec. 12, 2021, 8:37 p.m. OK GNU C++17 TESTS 37 1918 184012800
138935645 frangl E Dec. 12, 2021, 8:29 p.m. OK GNU C++17 TESTS 37 1933 184012800
138951260 baohiep E Dec. 13, 2021, 5:14 a.m. OK GNU C++17 TESTS 37 1949 147968000
138945630 kimoyami E Dec. 13, 2021, 2:53 a.m. OK GNU C++17 TESTS 37 1965 184012800
138911682 Kaitokid E Dec. 12, 2021, 4:40 p.m. OK GNU C++17 TESTS 34 2059 135168000
138919390 just_4th E Dec. 12, 2021, 5:06 p.m. OK GNU C++17 TESTS 34 2059 191897600
138946257 ryougishikilove E Dec. 13, 2021, 3:12 a.m. OK GNU C++17 TESTS 37 2308 196096000
138943929 neal E Dec. 13, 2021, 1:42 a.m. OK GNU C++17 (64) TESTS 37 997 279961600
138930168 E-Hentai E Dec. 12, 2021, 6:48 p.m. OK GNU C++17 (64) TESTS 36 1013 324710400
138928555 E-Hentai E Dec. 12, 2021, 6:27 p.m. OK GNU C++17 (64) TESTS 35 1029 268492800
138925316 E-Hentai E Dec. 12, 2021, 5:53 p.m. OK GNU C++17 (64) TESTS 34 1216 329011200
138936668 skittles1412 E Dec. 12, 2021, 8:53 p.m. OK GNU C++17 (64) TESTS 37 1418 388812800
138930963 rainboy E Dec. 12, 2021, 7:01 p.m. OK GNU C++17 (64) TESTS 37 1481 77107200
138930485 rainboy E Dec. 12, 2021, 6:53 p.m. OK GNU C++17 (64) TESTS 37 1512 248012800
138921415 black_white_tony E Dec. 12, 2021, 5:11 p.m. OK GNU C++17 (64) TESTS 34 1684 361779200
138943870 neal E Dec. 13, 2021, 1:40 a.m. OK GNU C++17 (64) TESTS 37 1699 279961600
138930038 rainboy E Dec. 12, 2021, 6:47 p.m. OK GNU C++17 (64) TESTS 36 1700 269516800
138950703 flukehn E Dec. 13, 2021, 5:03 a.m. OK GNU C++20 (64) TESTS 37 1013 283443200
138952826 ButterCake E Dec. 13, 2021, 5:45 a.m. OK GNU C++20 (64) TESTS 37 1091 276070400
138927208 Vercingetorix E Dec. 12, 2021, 6:11 p.m. OK GNU C++20 (64) TESTS 34 1216 311091200
138933492 Shrimp__ E Dec. 12, 2021, 7:44 p.m. OK GNU C++20 (64) TESTS 37 1216 376934400
138933526 Shrimp__ E Dec. 12, 2021, 7:45 p.m. OK GNU C++20 (64) TESTS 37 1231 376934400
138945247 TanakaAsuka E Dec. 13, 2021, 2:40 a.m. OK GNU C++20 (64) TESTS 37 1559 418099200
138924553 DreamingLeaf E Dec. 12, 2021, 5:48 p.m. OK GNU C++20 (64) TESTS 34 1637 255488000
138937516 czhang2718 E Dec. 12, 2021, 9:14 p.m. OK GNU C++20 (64) TESTS 37 1716 271872000
138951194 shndjm E Dec. 13, 2021, 5:13 a.m. OK GNU C++20 (64) TESTS 37 1731 223436800
138909800 physics0523 E Dec. 12, 2021, 4:34 p.m. OK GNU C++20 (64) TESTS 34 1871 300032000
138929705 Dukkha E Dec. 12, 2021, 6:42 p.m. OK Java 11 TESTS 36 2370 140185600

remove filters

Back to search problems