Codeforces Round 1073 (Div. 1)

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
2190 Codeforces Round 1073 (Div. 1) FINISHED False 10800 7745123 Jan. 17, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 941 ) D Prufer Vertex PROGRAMMING combinatorics dsu number theory probabilities trees

For a tree (T) with (n \ge 2) vertices, consider the standard process for generating its Prufer sequence . We repeatedly perform the following steps until only two vertices remain: Select the leaf with the smallest label; Remove it from the tree. It is known that vertex (n) is always one of the two remaining vertices. Let (v) be the other remaining vertex. We define the Prufer vertex of (T) as (P(T) = v). You are given a forest with (n) vertices and (m) edges. Let (k) be the number of connected components in this forest, and let their sizes be (s_1, s_2, \ldots, s_k). It is known that there are exactly (n^{k - 2} \prod\limits_{i=1}^k s_i) ways to add edges to the forest so that it becomes a single tree. For each (v) ((1 \le v < n)), calculate how many of these ways result in a tree (T) satisfying (P(T) = v). Since the answers can be large, print them 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 test case contains two integers (n) and (m) ((2 \le n \le 2 \cdot 10^5), (0 \le m \le n - 1)) — the number of vertices and edges in the forest, respectively. The next (m) lines of each test case contain two integers (u) and (v) ((1 \le u, v \le n, u \neq v)), describing an edge between vertices (u) and (v). It is guaranteed that these edges form a forest (that is, the graph is acyclic). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print (n - 1) integers on a single line. The (i)-th integer should be the number of ways to add edges to the forest so that it becomes a tree (T) satisfying (P(T) = i), modulo (998\,244\,353). In the first example, there are no edges in the forest, and there are (3) ways to comp

Tutorials

Codeforces Round 1073 (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
358350879 binaryDream D Jan. 17, 2026, 4:41 p.m. OK C++17 (GCC 7-32) TESTS 33 171 11264000
358377781 Harigton D Jan. 17, 2026, 6:59 p.m. OK C++17 (GCC 7-32) TESTS 33 218 6144000
358375492 More D Jan. 17, 2026, 6:41 p.m. OK C++17 (GCC 7-32) TESTS 33 234 7680000
358387416 none16094 D Jan. 17, 2026, 8:45 p.m. OK C++17 (GCC 7-32) TESTS 33 234 10342400
358401979 bubbarob19 D Jan. 18, 2026, 3:33 a.m. OK C++17 (GCC 7-32) TESTS 33 250 7884800
358339976 JDScript0117 D Jan. 17, 2026, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 33 250 9318400
358376429 imarn D Jan. 17, 2026, 6:48 p.m. OK C++17 (GCC 7-32) TESTS 33 250 9523200
358364977 Muelsyse D Jan. 17, 2026, 5:22 p.m. OK C++17 (GCC 7-32) TESTS 33 250 19251200
358346414 Swistakk D Jan. 17, 2026, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 33 250 20480000
358376976 activedeltorre D Jan. 17, 2026, 6:52 p.m. OK C++17 (GCC 7-32) TESTS 33 265 10444800
358350339 yeminghan D Jan. 17, 2026, 4:40 p.m. OK C++20 (GCC 13-64) TESTS 33 140 3686400
358344523 noya2 D Jan. 17, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 33 140 14848000
358368541 Saquariu D Jan. 17, 2026, 5:32 p.m. OK C++20 (GCC 13-64) TESTS 33 140 20889600
358347741 nantf D Jan. 17, 2026, 4:33 p.m. OK C++20 (GCC 13-64) TESTS 33 187 2252800
358377668 pokeland157 D Jan. 17, 2026, 6:58 p.m. OK C++20 (GCC 13-64) TESTS 33 203 17612800
358368441 www_bilibili_com D Jan. 17, 2026, 5:32 p.m. OK C++20 (GCC 13-64) TESTS 33 203 18739200
358327158 tml27 D Jan. 17, 2026, 3:52 p.m. OK C++20 (GCC 13-64) TESTS 33 203 21708800
358358520 Genius_Star_rgw D Jan. 17, 2026, 5:02 p.m. OK C++20 (GCC 13-64) TESTS 33 218 9011200
358341626 Furioso_Slient D Jan. 17, 2026, 4:19 p.m. OK C++20 (GCC 13-64) TESTS 33 218 10956800
358395903 lhy123 D Jan. 18, 2026, 12:53 a.m. OK C++20 (GCC 13-64) TESTS 33 218 13209600
358357056 tempura0224 D Jan. 17, 2026, 4:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 125 0
358327469 Sulfox D Jan. 17, 2026, 3:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 156 22732800
358356116 XiaY D Jan. 17, 2026, 4:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 156 25497600
358336811 ProjectCF D Jan. 17, 2026, 4:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 156 58880000
358308127 foreverlasting1202 D Jan. 17, 2026, 3:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 171 8499200
358376871 rgnerdplayer D Jan. 17, 2026, 6:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 187 12902400
358349833 111445 D Jan. 17, 2026, 4:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 187 53555200
358375905 Boboge D Jan. 17, 2026, 6:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 203 8089600
358365159 Billly D Jan. 17, 2026, 5:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 203 9420800
358376785 hkoasis8 D Jan. 17, 2026, 6:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 203 13004800
358312493 hos.lyric D Jan. 17, 2026, 3:29 p.m. OK D TESTS 33 484 27648000
358317906 scau_accepted D Jan. 17, 2026, 3:37 p.m. OK Go TESTS 33 203 28774400
358344399 showtime D Jan. 17, 2026, 4:26 p.m. OK Go TESTS 33 312 38604800
358340111 Tlatoani D Jan. 17, 2026, 4:16 p.m. OK Kotlin 2.2 TESTS 33 1156 43827200
358355775 bcollet D Jan. 17, 2026, 4:54 p.m. OK PyPy 2 TESTS 33 609 31539200
358355675 baldycape37 D Jan. 17, 2026, 4:54 p.m. OK PyPy 3-64 TESTS 33 500 71168000
358352933 conqueror_of_tourist D Jan. 17, 2026, 4:46 p.m. OK PyPy 3-64 TESTS 33 500 73216000
358329917 lunyi D Jan. 17, 2026, 3:56 p.m. OK PyPy 3-64 TESTS 33 640 52326400
358356455 hitman_py D Jan. 17, 2026, 4:56 p.m. OK PyPy 3-64 TESTS 33 640 53964800
358327551 the_last_smilodon D Jan. 17, 2026, 3:52 p.m. OK PyPy 3-64 TESTS 33 656 54374400
358348900 harurun4635 D Jan. 17, 2026, 4:36 p.m. OK PyPy 3-64 TESTS 33 765 74035200
358330265 golomb D Jan. 17, 2026, 3:57 p.m. OK PyPy 3-64 TESTS 33 812 50483200
358331934 literalchild D Jan. 17, 2026, 4 p.m. OK PyPy 3-64 TESTS 33 828 22016000
358324237 rusters D Jan. 17, 2026, 3:47 p.m. OK Rust 2021 TESTS 33 187 27340800
358334572 Mon_ster D Jan. 17, 2026, 4:05 p.m. OK Rust 2024 TESTS 33 203 31027200
358359062 Darknef D Jan. 17, 2026, 5:04 p.m. OK Rust 2024 TESTS 33 234 36761600
358319589 Sugar_fan D Jan. 17, 2026, 3:40 p.m. OK Rust 2024 TESTS 33 234 46796800
358354667 triple_affirmative D Jan. 17, 2026, 4:51 p.m. OK Rust 2024 TESTS 33 296 23347200

remove filters

Back to search problems