Codeforces Round 1046 (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
2135 Codeforces Round 1046 (Div. 1) FINISHED False 10800 20013923 Aug. 28, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3853 ) C By the Assignment PROGRAMMING bitmasks dfs and similar dsu graphs

For an undirected connected graph of (n) vertices, where the (i)-th vertex has a weight of (v_i), we define the value of a simple path(^{\text{∗}}) (l_1, l_2, \ldots, l_m) as (v_{l_1}\oplus v_{l_2}\oplus\cdots\oplus v_{l_m})(^{\text{†}}). We call the graph balanced if and only if: For every (1\le p<q\le n), all simple paths from (p) to (q) have the same value . Aquawave has given you an undirected connected graph of (n) vertices and (m) edges, and the (i)-th vertex in the graph has a weight of (a_i). However, some of the weights are missing, represented by (-1). Aquawave wants to assign an integer weight between (0) and (V-1) to each vertex with (a_i=-1), so that the graph will be balanced . You have to help Aquawave find the number of ways to assign weights to achieve the goal, modulo (998\,244\,353). (^{\text{∗}})A simple path from (c) to (d) is a sequence of vertices (l_1, l_2, \ldots, l_m), where (l_1=c), (l_m=d), such that there is an edge between (l_i) and (l_{i+1}) for every (1\le i\le m-1), and there are no repeated vertices, i.e. (l_i\ne l_j) for (1\le i<j\le n). (^{\text{†}})(\oplus) denotes the bitwise XOR operation . 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 three integers (n), (m), and (V) ((2\le n\le 2\cdot 10^5), (n-1\le m\le \min\left(\frac{n(n-1)}{2}, 4\cdot 10^5\right)), (1\le V\le 10^9)) — the number of vertices, the number of edges, and the upper bound of weights. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((-1\le a_i\le V-1)) — the weights of the vertices. (a_i=-1) represents that the weight of the (i)-th vertex is missing. Then (m) lines follow, the (i)-th line containing two

Tutorials

Codeforces Round 1046 (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
336036385 og.kostya C Aug. 28, 2025, 5:13 p.m. OK C# 10 TESTS 44 577 57036800
336018039 -firefly- C Aug. 28, 2025, 4:25 p.m. OK C# 13 TESTS 44 1421 100044800
336007449 temporary1 C Aug. 28, 2025, 4 p.m. OK C++17 (GCC 7-32) TESTS 44 374 17203200
335992404 KroosTheKeenGlint C Aug. 28, 2025, 3:31 p.m. OK C++17 (GCC 7-32) TESTS 44 405 16179200
335998975 CrispyLobster C Aug. 28, 2025, 3:43 p.m. OK C++17 (GCC 7-32) TESTS 44 405 23347200
336074836 super_zt C Aug. 29, 2025, 2:50 a.m. OK C++17 (GCC 7-32) TESTS 45 405 34304000
336082965 wind_cross C Aug. 29, 2025, 4:52 a.m. OK C++17 (GCC 7-32) TESTS 45 405 83251200
336078619 szcQAQ C Aug. 29, 2025, 3:48 a.m. OK C++17 (GCC 7-32) TESTS 45 421 34816000
336023873 lsflsf2023 C Aug. 28, 2025, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 44 436 52838400
336071675 sherman2022 C Aug. 29, 2025, 2 a.m. OK C++17 (GCC 7-32) TESTS 45 437 35532800
336013583 under1oop C Aug. 28, 2025, 4:14 p.m. OK C++17 (GCC 7-32) TESTS 44 437 95539200
336020895 MCPlayer542 C Aug. 28, 2025, 4:32 p.m. OK C++17 (GCC 7-32) TESTS 44 452 14540800
335996440 max0810 C Aug. 28, 2025, 3:39 p.m. OK C++20 (GCC 13-64) TESTS 44 296 28979200
336070001 zhy1206 C Aug. 29, 2025, 1:29 a.m. OK C++20 (GCC 13-64) TESTS 45 312 65126400
335987828 noya2 C Aug. 28, 2025, 3:24 p.m. OK C++20 (GCC 13-64) TESTS 44 327 18227200
336074734 lldxjw C Aug. 29, 2025, 2:49 a.m. OK C++20 (GCC 13-64) TESTS 45 343 25190400
336007288 Tom66 C Aug. 28, 2025, 4 p.m. OK C++20 (GCC 13-64) TESTS 44 358 13004800
336039569 licn090605 C Aug. 28, 2025, 5:22 p.m. OK C++20 (GCC 13-64) TESTS 44 374 60313600
336004618 chen_zida C Aug. 28, 2025, 3:55 p.m. OK C++20 (GCC 13-64) TESTS 44 374 71168000
335992969 w2y51c318 C Aug. 28, 2025, 3:32 p.m. OK C++20 (GCC 13-64) TESTS 44 405 95744000
335993636 _wrz_ C Aug. 28, 2025, 3:34 p.m. OK C++20 (GCC 13-64) TESTS 44 421 33996800
336088359 UniGravity C Aug. 29, 2025, 5:52 a.m. OK C++20 (GCC 13-64) TESTS 45 421 34918400
336002623 26100154 C Aug. 28, 2025, 3:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 233 29798400
336008248 farfaryyds1013 C Aug. 28, 2025, 4:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 265 32051200
335980120 Nachia C Aug. 28, 2025, 3:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 280 21913600
336004878 _cly_ C Aug. 28, 2025, 3:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 343 36147200
335993915 defnotmee C Aug. 28, 2025, 3:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 358 34201600
336001758 nullptr_qwq C Aug. 28, 2025, 3:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 358 90009600
336008581 little_rain C Aug. 28, 2025, 4:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 389 33075200
336004798 huansir C Aug. 28, 2025, 3:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 389 38809600
336004496 csp1025 C Aug. 28, 2025, 3:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 390 29081600
335978258 furry C Aug. 28, 2025, 3:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 390 34201600
336013641 pengin_2000 C Aug. 28, 2025, 4:14 p.m. OK GNU C11 TESTS 44 952 41062400
335998376 Transformer911 C Aug. 28, 2025, 3:42 p.m. OK Go TESTS 44 531 73011200
335992544 Sincerely_yours C Aug. 28, 2025, 3:32 p.m. OK Kotlin 1.9 TESTS 44 2702 240537600
336010453 Tlatoani C Aug. 28, 2025, 4:07 p.m. OK Kotlin 2.2 TESTS 44 1796 119705600
335985893 tassei903 C Aug. 28, 2025, 3:21 p.m. OK PyPy 3-64 TESTS 44 1468 85811200
336015393 ow3nL C Aug. 28, 2025, 4:19 p.m. OK PyPy 3-64 TESTS 44 1483 70041600
335980200 harurun4635 C Aug. 28, 2025, 3:14 p.m. OK PyPy 3-64 TESTS 44 1640 145510400
336019587 titia C Aug. 28, 2025, 4:29 p.m. OK PyPy 3-64 TESTS 44 1655 173977600
336013375 stan23456 C Aug. 28, 2025, 4:14 p.m. OK PyPy 3-64 TESTS 44 1687 140595200
336017262 x3x3 C Aug. 28, 2025, 4:23 p.m. OK PyPy 3-64 TESTS 44 1749 152678400
336053636 LMeyling C Aug. 28, 2025, 7:46 p.m. OK PyPy 3-64 TESTS 44 1780 110080000
335998504 ValeriyShiyan C Aug. 28, 2025, 3:42 p.m. OK PyPy 3-64 TESTS 44 1828 104550400
335987328 golomb C Aug. 28, 2025, 3:24 p.m. OK PyPy 3-64 TESTS 44 1874 96665600
336051748 monocrap C Aug. 28, 2025, 7:29 p.m. OK PyPy 3-64 TESTS 44 1874 201318400
335987987 Sugar_fan C Aug. 28, 2025, 3:25 p.m. OK Rust 2021 TESTS 44 406 60108800
336014992 darkkcyan C Aug. 28, 2025, 4:18 p.m. OK Rust 2024 TESTS 44 531 57753600

remove filters

Back to search problems