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 |
|---|---|---|---|---|---|---|
| 2223 | Codeforces Round 1097 (Div. 1, Based on Zhili Cup 2026) | FINISHED | False | 9000 | 3282906 | May 6, 2026, 6:05 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 826 ) | C | Zhily and Signpost | PROGRAMMING | binary search chinese remainder theorem dfs and similar math number theory trees |
While returning to the base, Jily lost his way. He found that the paths ahead formed a tree. At every fork in the road, there was a signpost, but these signposts were affected by an anomalous magnetic field and kept rotating. Zhily became worried about Jily and wants to ask you several questions. Each time, given a specific moment, he asks which node Jily would eventually stop at if he started from the beginning. You are given a tree with (n) nodes, rooted at (1). Node (u) has (d_u) children, sorted by node index in increasing order, namely (s_{u,0},\ldots,s_{u,d_u-1}). It takes some time to cross each edge; specifically, the time needed to cross the edge between node (u) and its parent is (l_u). Each non-leaf node in the tree has a signpost pointing to one of its children. When you are at such a node, you must immediately move to the child it points to, continuing in this way until you reach a leaf node, where you stop immediately. The signposts change over time. At time (m), the signpost of node (u) points to its ((m\bmod d_u+1))-th child, that is, node (s_{u,m \bmod d_u}). There are now (q) queries. In each query, you are given (m), and you need to determine the index of the leaf node you will eventually reach if you start from the root at time (m). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two positive integers (n,q) ((1 \le n \le 5 \cdot 10^5,1 \le q \le 10^6)). The second line contains (n-1) positive integers (f_2,\ldots,f_n) ((1 \le f_u \lt u)), where (f_u) denotes the index of the parent of node (u). The third line contains (n-1) non-negative integers (l_2,\ldots,l_n) ((0 \le l_u \le 10^9)), where (l_u) denotes the time needed to cross the edge between node (u) and its parent. The fo |
| Codeforces Round 1097 (Div. 1, Div2, Based on Zhili Cup 2026) Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 373673760 | caffeine2ac | C | May 6, 2026, 7:10 a.m. | OK | C# 13 | TESTS | 20 | 484 | 97689600 | ||
| 373691448 | sbt214 | C | May 6, 2026, 8:31 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 750 | 99225600 | ||
| 373716424 | dinohaur | C | May 6, 2026, 12:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 23 | 796 | 49664000 | ||
| 373684653 | chenwenmo | C | May 6, 2026, 8 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 796 | 87142400 | ||
| 373673526 | qwef_ | C | May 6, 2026, 7:09 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 1000 | 128614400 | ||
| 373691557 | Midhilesh | C | May 6, 2026, 8:32 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 1015 | 145408000 | ||
| 373673181 | keisuke6 | C | May 6, 2026, 7:08 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 1015 | 254771200 | ||
| 373689967 | Potassium | C | May 6, 2026, 8:25 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 1140 | 55500800 | ||
| 373685893 | howB | C | May 6, 2026, 8:06 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 1156 | 74547200 | ||
| 373726961 | DeaphetS | C | May 6, 2026, 1:58 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 1265 | 38604800 | ||
| 373747267 | ketnosak | C | May 6, 2026, 5:02 p.m. | OK | C++17 (GCC 7-32) | TESTS | 27 | 1265 | 38604800 | ||
| 373714251 | maxplus | C | May 6, 2026, 12:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 23 | 281 | 138444800 | ||
| 373708060 | maxplus | C | May 6, 2026, 11:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 22 | 390 | 100454400 | ||
| 373783496 | mahiro_zcy | C | May 7, 2026, 5:53 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 593 | 131993600 | ||
| 373678160 | mahiro_zcy | C | May 6, 2026, 7:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 640 | 131891200 | ||
| 373671175 | fydj | C | May 6, 2026, 7 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 656 | 95539200 | ||
| 373747125 | AkusikCarrot | C | May 6, 2026, 5 p.m. | OK | C++20 (GCC 13-64) | TESTS | 27 | 687 | 385945600 | ||
| 373664842 | bnnpuu | C | May 6, 2026, 6:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 703 | 106803200 | ||
| 373670941 | NotOnlySuccess | C | May 6, 2026, 7 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 718 | 146944000 | ||
| 373676024 | Mango2011 | C | May 6, 2026, 7:20 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 734 | 228352000 | ||
| 373706499 | Nailong2026 | C | May 6, 2026, 11:06 a.m. | OK | C++20 (GCC 13-64) | TESTS | 22 | 734 | 664166400 | ||
| 373696445 | superguymj | C | May 6, 2026, 9:16 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 375 | 38400000 | ||
| 373695866 | superguymj | C | May 6, 2026, 9:11 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 375 | 38502400 | ||
| 373670563 | maspy | C | May 6, 2026, 6:58 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 375 | 97280000 | ||
| 373671281 | jiangbowen | C | May 6, 2026, 7:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 406 | 133427200 | ||
| 373668679 | IkunTeddy | C | May 6, 2026, 6:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 421 | 238387200 | ||
| 373671779 | MtSaka | C | May 6, 2026, 7:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 562 | 213401600 | ||
| 373696061 | superguymj | C | May 6, 2026, 9:13 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 625 | 36454400 | ||
| 373702207 | scorpion | C | May 6, 2026, 10:17 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 22 | 656 | 79667200 | ||
| 373678776 | CutieSmileHaruka | C | May 6, 2026, 7:31 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 671 | 31744000 | ||
| 373712382 | cyu17 | C | May 6, 2026, noon | OK | C++23 (GCC 14-64, msys2) | TESTS | 23 | 671 | 199987200 | ||
| 373676157 | codecrasher_ | C | May 6, 2026, 7:20 a.m. | OK | Go | TESTS | 20 | 718 | 134758400 | ||
| 373680031 | gofrozen21 | C | May 6, 2026, 7:37 a.m. | OK | Java 21 | TESTS | 20 | 734 | 152883200 | ||
| 373695883 | MBBN | C | May 6, 2026, 9:12 a.m. | OK | Java 21 | TESTS | 20 | 750 | 152064000 | ||
| 373682174 | hardgonnapass | C | May 6, 2026, 7:48 a.m. | OK | Java 8 | TESTS | 20 | 1906 | 86528000 | ||
| 373682917 | bitplease_ | C | May 6, 2026, 7:52 a.m. | OK | Node.js | TESTS | 20 | 1421 | 141619200 | ||
| 373695034 | Little_Sheep_Yawn | C | May 6, 2026, 9:04 a.m. | OK | PyPy 3-64 | TESTS | 20 | 1578 | 377856000 | ||
| 373679469 | smilences | C | May 6, 2026, 7:35 a.m. | OK | PyPy 3-64 | TESTS | 20 | 1578 | 377856000 | ||
| 373778676 | chmpro | C | May 7, 2026, 4:20 a.m. | OK | PyPy 3-64 | TESTS | 30 | 1656 | 228761600 | ||
| 373706555 | sansen | C | May 6, 2026, 11:07 a.m. | OK | Rust 2021 | TESTS | 22 | 625 | 166707200 | ||
| 373670820 | sansen | C | May 6, 2026, 6:59 a.m. | OK | Rust 2021 | TESTS | 20 | 828 | 172748800 | ||
| 373687928 | DanielAnker | C | May 6, 2026, 8:16 a.m. | OK | Rust 2024 | TESTS | 20 | 1218 | 257433600 | ||
| 373688970 | Egor | C | May 6, 2026, 8:21 a.m. | OK | Rust 2024 | TESTS | 20 | 1593 | 303718400 |
Back to search problems