Spectral::Cup 2026 Round 2 (Codeforces Round 1100, 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
2229 Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + Div. 2) FINISHED False 10800 833086 May 23, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1546 ) E Deconstruction Tree PROGRAMMING combinatorics data structures dp graphs trees

A tree with (n) nodes fell from the sky along with an initially empty set (S). Ecstatic by this unlikely event, you do the following (n - 1) times: let (x) be the leaf with maximum index. add (x) into (S) (note that if (x) is already in (S) then nothing changes). select any leaf other than (x) and remove it from the tree. Determine the number of distinct sets (S) you can make. As the number could be ginormous, output it modulo (998\,244\,353). 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 testcase contains an integer (n) ((2 \le n \le 2 \cdot 10^5)) — the size of the tree. Then (n - 1) lines follow, each of which contain two integers (u) and (v) ((1 \le u,v \le n, u \ne v)), which describe a pair of vertices connected by an edge. It is guaranteed that the given graph is a tree. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). Output the number of distinct sets that can be obtained modulo (998\,244\,353). For the first testcase, there is only one possible order: (1), making the set (\{2\}) For the third testcase, the tree looks as follows: you can make the sets: (\{3, 6, 7\}) by removing in the order (1, 2, 3, 4, 5, 6) (\{3, 4, 6, 7\}) by removing in the order (2, 1, 3, 4, 5, 6) (\{3, 4, 5, 6, 7\}) by removing in the order (2, 3, 1, 4, 5, 6) It can be proven that these are the only sets obtainable.

Tutorials

Spectral::Cup 2026 Round 2 (Codeforces Round 1100, 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
375846848 ok12 E May 23, 2026, 5:26 p.m. OK C# 13 TESTS 28 296 42905600
375831460 ZB001 E May 23, 2026, 4:19 p.m. OK C++17 (GCC 7-32) TESTS 28 125 11571200
375833040 deadlockdev E May 23, 2026, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 28 156 9728000
375842933 yinghua_luoxue E May 23, 2026, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 28 203 17715200
375834336 under1oop E May 23, 2026, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 28 203 93798400
375856592 panospask E May 23, 2026, 6:45 p.m. OK C++17 (GCC 7-32) TESTS 28 234 7372800
375869870 algoplutus E May 23, 2026, 9:03 p.m. OK C++17 (GCC 7-32) TESTS 28 234 9318400
375836774 Bubbleawa E May 23, 2026, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 28 234 11059200
375859495 Sanya239 E May 23, 2026, 7:07 p.m. OK C++17 (GCC 7-32) TESTS 28 234 27545600
375847163 shihoghmean E May 23, 2026, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 28 234 98611200
375829084 Brock77 E May 23, 2026, 4:11 p.m. OK C++17 (GCC 7-32) TESTS 28 250 7782400

remove filters

Back to search problems