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 |
|---|---|---|---|---|---|---|
| 2194 | Codeforces Round 1078 (Div. 2) | FINISHED | False | 7200 | 5864123 | Feb. 8, 2026, 9:05 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 871 ) | F1 | Again Trees... (Easy Version) | PROGRAMMING | bitmasks dfs and similar dp fft trees |
This is the easy version of the problem. The difference between the versions is that in this version, (k \leq 4). You can hack only if you solved all versions of this problem. Given a tree consisting of (n) vertices. Each vertex has a non-negative integer (a_v) written on it. You are also given (k) distinct non-negative integers (b_1, \ldots, b_k). We will call a set of edges beautiful if, after removing these edges from the tree, the tree splits into connected components, where in each component the bitwise XOR of all the numbers (a_v) in that component belongs to the set (b). You need to count the number of beautiful sets of edges in the tree modulo (10^9 + 7). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each dataset contains two integers (n) and (k) ((2 \leq n \leq 10^5), (1 \leq k \leq 4)) — the number of vertices in the tree and the size of the set (b). The next (n - 1) lines describe the edges of the tree. The (i)-th line contains two integers (v_i) and (u_i) ((1 \leq v_i, u_i \leq n)) — the numbers of the vertices connected by the (i)-th edge. The next line contains (n) integers (a_1, a_2, \ldots, a_n) ((0 \leq a_i \lt 2^{30})) — the values written on the vertices. The following line contains (k) distinct integers (b_1, b_2, \ldots, b_k) ((0 \leq b_i \lt 2^{30})) — the elements of the set (b). It is guaranteed that the sum of (n) across all datasets does not exceed (10^5). For each test dataset, output a single integer — the answer to the problem. Illustration for the first test dataset. In it, you can remove the edge between vertices (1) and (2). Then the bitwise XOR in the component consisting of vertices (2) and (5) is (a_2 \oplus a_5 = 2 \oplus 3 = 1). The bitwise XOR in the comp |
| Codeforces Round #1078 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 362055437 | papa_joo | F1 | Feb. 8, 2026, 8:30 p.m. | OK | C# 13 | TESTS | 32 | 703 | 61132800 | ||
| 361996220 | sjtu-wya2007 | F1 | Feb. 8, 2026, 10:56 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 156 | 16076800 | ||
| 361993539 | Elhpycrv | F1 | Feb. 8, 2026, 10:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 171 | 30924800 | ||
| 361999457 | LightParticle | F1 | Feb. 8, 2026, 11:04 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 187 | 13004800 | ||
| 361998852 | yashwant.A | F1 | Feb. 8, 2026, 11:02 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 203 | 16588800 | ||
| 361996820 | austin.chen | F1 | Feb. 8, 2026, 10:58 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 218 | 8704000 | ||
| 361993965 | shy_guy_16 | F1 | Feb. 8, 2026, 10:51 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 218 | 9420800 | ||
| 361993388 | Joskmo | F1 | Feb. 8, 2026, 10:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 218 | 17612800 | ||
| 361994473 | LingLuo_Official | F1 | Feb. 8, 2026, 10:52 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 218 | 45465600 | ||
| 362063220 | ta2ly.id | F1 | Feb. 8, 2026, 11:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 234 | 825856000 | ||
| 361995640 | balakrishnan | F1 | Feb. 8, 2026, 10:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 32 | 250 | 9830400 | ||
| 362029052 | thisislike_fan | F1 | Feb. 8, 2026, 4:04 p.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 109 | 10035200 | ||
| 362027041 | thisislike_fan | F1 | Feb. 8, 2026, 3:47 p.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 10137600 | ||
| 362027837 | thisislike_fan | F1 | Feb. 8, 2026, 3:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 10547200 | ||
| 361996346 | wenbang | F1 | Feb. 8, 2026, 10:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 13721600 | ||
| 362063745 | xvtianze | F1 | Feb. 9, 2026, 12:13 a.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 14540800 | ||
| 361994834 | gargaayush686 | F1 | Feb. 8, 2026, 10:53 a.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 15257600 | ||
| 362034508 | Hamed_Ghaffari | F1 | Feb. 8, 2026, 4:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 26521600 | ||
| 362031427 | xly_tyty | F1 | Feb. 8, 2026, 4:25 p.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 171 | 39219200 | ||
| 362033607 | wrihapcod | F1 | Feb. 8, 2026, 4:45 p.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 187 | 20582400 | ||
| 362073660 | niter | F1 | Feb. 9, 2026, 4:09 a.m. | OK | C++20 (GCC 13-64) | TESTS | 32 | 187 | 27852800 | ||
| 362028581 | 415411 | F1 | Feb. 8, 2026, 4 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 125 | 11059200 | ||
| 362064923 | aoliao_lovely | F1 | Feb. 9, 2026, 12:50 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 140 | 18944000 | ||
| 361996887 | Youumu | F1 | Feb. 8, 2026, 10:58 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 140 | 30924800 | ||
| 362066689 | _XVIIVX | F1 | Feb. 9, 2026, 1:47 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 140 | 35840000 | ||
| 362023286 | 415411 | F1 | Feb. 8, 2026, 3:18 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 140 | 430284800 | ||
| 362032400 | PSURI1894 | F1 | Feb. 8, 2026, 4:34 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 156 | 16384000 | ||
| 362066995 | Crimson_ | F1 | Feb. 9, 2026, 1:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 156 | 19353600 | ||
| 362064685 | GOTKAKO | F1 | Feb. 9, 2026, 12:44 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 171 | 15052800 | ||
| 362065044 | ZZFLS_zwr | F1 | Feb. 9, 2026, 12:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 171 | 18432000 | ||
| 361998668 | hardworkiskey_1308 | F1 | Feb. 8, 2026, 11:02 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 171 | 20992000 | ||
| 361996722 | Abhinav1116 | F1 | Feb. 8, 2026, 10:58 a.m. | OK | Java 21 | TESTS | 32 | 734 | 31027200 | ||
| 362046359 | hg_2005 | F1 | Feb. 8, 2026, 6:31 p.m. | OK | Java 21 | TESTS | 32 | 828 | 56627200 | ||
| 362052882 | gulshankumar143 | F1 | Feb. 8, 2026, 7:52 p.m. | OK | Java 21 | TESTS | 32 | 906 | 44748800 | ||
| 362017648 | _Ambitious_ | F1 | Feb. 8, 2026, 2:37 p.m. | OK | Java 8 | TESTS | 32 | 531 | 47923200 | ||
| 361998937 | keri3 | F1 | Feb. 8, 2026, 11:03 a.m. | OK | PyPy 3-64 | TESTS | 32 | 500 | 76902400 | ||
| 361997832 | Madhavan2003 | F1 | Feb. 8, 2026, 11 a.m. | OK | PyPy 3-64 | TESTS | 32 | 546 | 311193600 | ||
| 362039869 | Ergodic137 | F1 | Feb. 8, 2026, 5:31 p.m. | OK | PyPy 3-64 | TESTS | 32 | 546 | 314675200 | ||
| 362026689 | sushmanth.dampur8780 | F1 | Feb. 8, 2026, 3:44 p.m. | OK | PyPy 3-64 | TESTS | 32 | 562 | 67584000 | ||
| 362056137 | hugoback01 | F1 | Feb. 8, 2026, 8:43 p.m. | OK | PyPy 3-64 | TESTS | 32 | 593 | 62873600 | ||
| 362033560 | tealab | F1 | Feb. 8, 2026, 4:45 p.m. | OK | PyPy 3-64 | TESTS | 32 | 640 | 43008000 | ||
| 361999435 | Takanashi_Rikka | F1 | Feb. 8, 2026, 11:03 a.m. | OK | PyPy 3-64 | TESTS | 32 | 703 | 62668800 |
Back to search problems