Order Capital Round 2 (Codeforces Round 1104, 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
2237 Order Capital Round 2 (Codeforces Round 1104, Div. 1 + Div. 2) FINISHED False 10800 4807484 June 18, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 71 ) I1 DBFS Order (Easy Version) PROGRAMMING dp trees

This is the easy version of the problem. The difference between the versions is that in this version, the string (s) contains no character 1 . You can hack only if you solved all versions of this problem. You are given a rooted tree with (n) vertices, rooted at vertex (1). For each vertex, its children are given in a fixed order. Each vertex except the root has a color, either (0) or (1). For a fixed coloring, define the following traversal. After the process ends, the list (p) is called the traversal list of this coloring. It can be shown that (p) is always a permutation of (1,2,\ldots,n). In particular, if all colors are (0), then (p) is the DFS preorder of the tree; if all colors are (1), then (p) is the BFS order of the tree, where children are visited in the given order. You are given a string (s) of length (n-1), consisting of characters 0 , 1 , and ? . For each vertex (i) with (2\le i\le n), the character (s_{i-1}) describes the possible color of vertex (i): if (s_{i-1}=0), then vertex (i) must have color (0); if (s_{i-1}=1), then vertex (i) must have color (1); if (s_{i-1}=?), then vertex (i) may have color (0) or (1). Find the number of distinct traversal lists that can be obtained over all valid colorings. Since the answer may be large, output it modulo (10^9+7). 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 an integer (n) ((2 \le n \le 3000)) — the number of vertices in the tree. The second line contains a string (s) of length (n-1). In the easy version, (s) consists only of characters 0 and ? . The character (s_i) describes the possible color of vertex (i+1). The next (n) lines describe the ordered lists of child

Tutorials

Order Capital Round 2 (Codeforces Round 1104, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
379438504 FreddieLiu I1 June 18, 2026, 11:39 p.m. OK C++20 (GCC 13-64) TESTS 44 250 577638400
379444577 StarSilk I1 June 19, 2026, 2:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 218 577638400
379434937 aan93 I1 June 18, 2026, 9:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 468 0
379425131 ecnerwala I1 June 18, 2026, 6:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 750 138649600
379456097 edmondium23 I1 June 19, 2026, 5:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 1187 647987200
379428984 ProblemI2isEasy I1 June 18, 2026, 7:18 p.m. OK PyPy 3-64 TESTS 44 1265 69632000
379451438 Muhammadzaki_Juraev I1 June 19, 2026, 4:54 a.m. OK PyPy 3-64 TESTS 44 1640 70144000
379439337 ProblemI2isEasy I1 June 19, 2026, 12:12 a.m. OK PyPy 3-64 TESTS 44 1734 81715200

remove filters

Back to search problems