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 |
|---|---|---|---|---|---|---|
| 2174 | Codeforces Round 1069 (Div. 1) | FINISHED | False | 7200 | 11396723 | Dec. 6, 2025, 8:15 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 447 ) | F | Mosaic Tree | PROGRAMMING | combinatorics dp fft math trees |
The master creates a composition of (n) colored mosaic elements. Each element is painted in one of (m) possible colors (the colors are numbered from (1) to (m)). The master arranges the composition in such a way that it can be represented as a tree. The composition is considered beautiful if for each color (i), the total degree of all vertices of color (i) has a specified parity (\mathrm{mask}_i), where (\mathrm{mask}) is an array of (m) numbers (0) or (1). Help the master count the number of ways to create a beautiful composition. Output the answer modulo (10^9 + 7). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((1 \le n, m \le 10^4)) — the number of vertices and the number of possible colors, respectively. The second line of each test case contains (n) integers (c_i) ((1 \le c_i \le m)) — the color of vertex (i). The third line of each test case contains (m) integers (\mathrm{mask}_i) ((\mathrm{mask}_i \in \{0, 1\})) — the parity of color (i) (if the total degree of vertices of color (i) should be even, (\mathrm{mask}_i = 0), otherwise — (\mathrm{mask}_i = 1)). It is guaranteed that the sum of the values of (n) across all test cases does not exceed (10^4), and it is also guaranteed that the sum of the values of (m) across all test cases does not exceed (10^4). For each test case, output a single integer on a separate line — the number of ways to create a beautiful composition modulo (10^9 + 7). In the first test case, a valid example of a tree would be described by the edges (\{(1, 2), (1, 3), (1, 4)\}). Here, the degrees are (3, 1, 1, 1) respectively. Here, the total degree of vertices with colour (1) is (4) which is (0) mod $$$ |
| Codeforces Round 1069 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 352304890 | NONANE.X | F | Dec. 6, 2025, 6:50 p.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 343 | 102400 | ||
| 352231897 | Ant_Man | F | Dec. 6, 2025, 9:51 a.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 343 | 102400 | ||
| 352288344 | krio131 | F | Dec. 6, 2025, 4:36 p.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 375 | 102400 | ||
| 352265223 | Ali_Adelkhah | F | Dec. 6, 2025, 1:48 p.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 421 | 102400 | ||
| 352201554 | littleju | F | Dec. 6, 2025, 8:39 a.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 562 | 409600 | ||
| 352342112 | maxymien | F | Dec. 7, 2025, 5:59 a.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 609 | 0 | ||
| 352237936 | Austin__Griffin | F | Dec. 6, 2025, 10:09 a.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 640 | 307200 | ||
| 352226586 | Sept | F | Dec. 6, 2025, 9:35 a.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 656 | 102400 | ||
| 352266994 | MakeFlorrGreatAgain | F | Dec. 6, 2025, 2 p.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 687 | 102400 | ||
| 352265578 | Miniest | F | Dec. 6, 2025, 1:51 p.m. | OK | C++17 (GCC 7-32) | TESTS | 73 | 765 | 409600 | ||
| 352330762 | nullptr_qwq | F | Dec. 7, 2025, 2:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 93 | 307200 | ||
| 352263044 | 415411 | F | Dec. 6, 2025, 1:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 109 | 0 | ||
| 352263949 | dieselhuang | F | Dec. 6, 2025, 1:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 109 | 204800 | ||
| 352233457 | GrandSouris | F | Dec. 6, 2025, 9:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 109 | 512000 | ||
| 352210058 | lishujia090623 | F | Dec. 6, 2025, 8:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 140 | 512000 | ||
| 352260905 | wangxiaojingzi | F | Dec. 6, 2025, 1:20 p.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 156 | 102400 | ||
| 352237188 | beiyuli | F | Dec. 6, 2025, 10:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 156 | 204800 | ||
| 352237147 | NKheyuxiang | F | Dec. 6, 2025, 10:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 156 | 204800 | ||
| 352278646 | Amadeus__ | F | Dec. 6, 2025, 3:22 p.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 171 | 102400 | ||
| 352261003 | wangxiaojingzi | F | Dec. 6, 2025, 1:21 p.m. | OK | C++20 (GCC 13-64) | TESTS | 73 | 171 | 102400 | ||
| 352235317 | maspy | F | Dec. 6, 2025, 10:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 78 | 307200 | ||
| 352323816 | jiangxinyang2012 | F | Dec. 7, 2025, 12:14 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 78 | 11468800 | ||
| 352262222 | _O_v_O_ | F | Dec. 6, 2025, 1:29 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 93 | 102400 | ||
| 352324989 | cmk666 | F | Dec. 7, 2025, 12:45 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 93 | 614400 | ||
| 352228072 | Nyaan | F | Dec. 6, 2025, 9:39 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 93 | 67276800 | ||
| 352287397 | lzyrapx | F | Dec. 6, 2025, 4:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 109 | 102400 | ||
| 352324830 | Boboge | F | Dec. 7, 2025, 12:41 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 140 | 102400 | ||
| 352270404 | Eason_He | F | Dec. 6, 2025, 2:24 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 140 | 102400 | ||
| 352235231 | Rocky_dp | F | Dec. 6, 2025, 10:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 140 | 102400 | ||
| 352260004 | white_unicorn | F | Dec. 6, 2025, 1:15 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 73 | 156 | 102400 | ||
| 352233513 | gua069 | F | Dec. 6, 2025, 9:56 a.m. | OK | Java 8 | TESTS | 73 | 1453 | 0 | ||
| 352299102 | sansen | F | Dec. 6, 2025, 6:06 p.m. | OK | Rust 2021 | TESTS | 73 | 62 | 102400 | ||
| 352236790 | sansen | F | Dec. 6, 2025, 10:06 a.m. | OK | Rust 2021 | TESTS | 73 | 1484 | 4198400 | ||
| 352215104 | Monster027 | F | Dec. 6, 2025, 9:07 a.m. | OK | Rust 2024 | TESTS | 73 | 140 | 0 |
Back to search problems