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 |
---|---|---|---|---|---|---|
1900 | Codeforces Round 911 (Div. 2) | FINISHED | False | 7200 | 36170663 | Nov. 26, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 11999 ) | C | Anji's Binary Tree | PROGRAMMING | dfs and similar dp shortest paths trees |
B"Keksic keeps getting left on seen by Anji. Through a mutual friend, he's figured out that Anji really likes binary trees and decided to solve her problem in order to get her attention. Anji has given Keksic a binary tree with n vertices. Vertex 1 is the root and does not have a parent. All other vertices have exactly one parent. Each vertex can have up to 2 children, a left child, and a right child. For each vertex, Anji tells Keksic index of both its left and its right child or tells him that they do not exist. Additionally, each of the vertices has a letter s_i on it, which is either 'U', 'L' or 'R'. Keksic begins his journey on the root, and in each move he does the following: You are interested in the minimal number of operations he needs to do before his journey, such that when he starts his journey, he will reach a leaf at some point. A leaf is a vertex that has no children. It does not matter which leaf he reaches. Note that it does not matter whether he will stay in the leaf, he just needs to move to it. Additionally, note that it does not matter how many times he needs to move before reaching a leaf. Help Keksic solve Anji's tree so that he can win her heart, and make her come to xc4 x8ca xc4 x8dak. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 5 cdot 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 3 cdot 10^5 ) -- the number of vertices in a tree. The second line of each test case contains a string s of n characters -- characters are written on the vertices. It is guaranteed that s consists only of characters 'U', 'L', and 'R'. The i -th of the next n lines contains two integers l_i and r_i ( 0 <= l_i, r_i <= n ) -- indices of left and right child of the vertex i . If l_i = 0 , it means that ve"... |
Codeforces Round 911 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
234479516 | newbits | C | Nov. 26, 2023, 4:26 p.m. | OK | C# 10 | TESTS | 29 | 249 | 33075200 | ||
234469566 | Rokisek | C | Nov. 26, 2023, 3:51 p.m. | OK | C# 10 | TESTS | 29 | 405 | 53555200 | ||
234481082 | Nick2048 | C | Nov. 26, 2023, 4:33 p.m. | OK | D | TESTS | 29 | 389 | 13516800 | ||
234528511 | Mars_Dingdang | C | Nov. 27, 2023, 2:50 a.m. | OK | GNU C++14 | TESTS | 29 | 46 | 11059200 | ||
234527192 | qjm | C | Nov. 27, 2023, 2:22 a.m. | OK | GNU C++14 | TESTS | 29 | 109 | 7475200 | ||
234527049 | CLOCKS_PER_SEC | C | Nov. 27, 2023, 2:19 a.m. | OK | GNU C++14 | TESTS | 29 | 124 | 7475200 | ||
234476968 | Master640 | C | Nov. 26, 2023, 4:16 p.m. | OK | GNU C++14 | TESTS | 29 | 139 | 12288000 | ||
234540201 | LvwwwQi | C | Nov. 27, 2023, 5:42 a.m. | OK | GNU C++14 | TESTS | 29 | 140 | 9932800 | ||
234529227 | honey | C | Nov. 27, 2023, 3:03 a.m. | OK | GNU C++14 | TESTS | 29 | 140 | 12288000 | ||
234486721 | HuHu_Fei | C | Nov. 26, 2023, 5:32 p.m. | OK | GNU C++14 | TESTS | 29 | 155 | 9932800 | ||
234471570 | IlgvarsRocans | C | Nov. 26, 2023, 3:58 p.m. | OK | GNU C++14 | TESTS | 29 | 155 | 9932800 | ||
234472769 | Trainer_Marvin | C | Nov. 26, 2023, 4:01 p.m. | OK | GNU C++14 | TESTS | 29 | 155 | 11366400 | ||
234498771 | salvatorabhi | C | Nov. 26, 2023, 7:22 p.m. | OK | GNU C++14 | TESTS | 29 | 155 | 12288000 |
Back to search problems