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
( 139 ) H Slime and Queries PROGRAMMING data structures greedy trees

You are given a tree with (n) vertices numbered from (1) to (n). A slime occupies exactly (m) vertices of the tree. It is guaranteed that the subgraph induced by the occupied vertices is connected. Initially, the slime occupies vertices (s_1,s_2,\ldots,s_m). First, we define a function (f) on a sequence of vertices. Consider a sequence (a_1,a_2,\ldots,a_k). There are (k) pieces of food. For each (i), the (i)-th piece of food is located at vertex (a_i). At first, only the first piece of food appears. The slime may perform the following operations any number of times: Move . The slime removes itself from one currently occupied vertex and expands to one currently unoccupied vertex. Formally, let (S) be the current set of occupied vertices. Choose a vertex (u\in S) and a vertex (v\notin S), and replace (S) with ((S\setminus{u})\cup{v}). After the operation, the subgraph induced by (S) must still be connected. Formally, let (S) be the current set of occupied vertices. Choose a vertex (u\in S) and a vertex (v\notin S), and replace (S) with ((S\setminus{u})\cup{v}). After the operation, the subgraph induced by (S) must still be connected. Eat . If the (i)-th piece of food has appeared and the slime currently occupies vertex (a_i), then the slime may eat the (i)-th piece of food. If (1\le i \lt k), the ((i+1))-th piece of food appears immediately after that. Eating does not change the occupied vertices. Define (f(a_1,a_2,\ldots,a_k)) as the minimum number of Move operations needed for the slime to eat all (k) pieces of food in order, starting from the initial occupied vertices (s_1,s_2,\ldots,s_m). There are (q) queries. The input is forced online. The input gives encoded values (p_1,p_2,\ldots,p_q). Let (\mathrm{ans}_0=0). For each (i=1,2,\ldots,q), the actual vertex of the (i)-th query is $$$c_i=((p_i-1+\mathrm{ans}_{i

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
379435786 ProblemI2isEasy H June 18, 2026, 9:51 p.m. OK C++17 (GCC 7-32) TESTS 82 1296 17100800
379450963 qieman825 H June 19, 2026, 4:46 a.m. OK C++17 (GCC 7-32) TESTS 82 1562 8294400
379438516 FreddieLiu H June 18, 2026, 11:39 p.m. OK C++20 (GCC 13-64) TESTS 82 1578 13414400
379424578 moossego H June 18, 2026, 6:16 p.m. OK C++20 (GCC 13-64) TESTS 82 2765 40960000
379449105 edmondium23 H June 19, 2026, 4:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 82 1437 13004800
379449602 MATH00001 H June 19, 2026, 4:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 82 1500 13414400
379417799 Nachia H June 18, 2026, 5:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 82 1593 22323200
379444549 StarSilk H June 19, 2026, 2:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 82 1687 13414400
379425506 turmax H June 18, 2026, 6:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 82 2718 67686400
379433888 aan93 H June 18, 2026, 8:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 82 2765 16486400
379439162 ProblemI2isEasy H June 19, 2026, 12:05 a.m. OK PyPy 3-64 TESTS 82 2328 69836800
379438649 ProblemI2isEasy H June 18, 2026, 11:45 p.m. OK Python 3 TESTS 82 4234 60313600

remove filters

Back to search problems