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 |
|---|---|---|---|---|---|---|
| 2207 | Codeforces Round 1085 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 3425123 | March 8, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 814 ) | E2 | N-MEX (Counting Version) | PROGRAMMING | combinatorics math |
This is the counting version of the problem. The difference between the versions is that in this version, you need to count the number of constructions where (0 \leq b_i \leq n). You can hack only if you solved all versions of this problem. The Master Builder doesn't like repetitive tasks — repairing the base, upgrading the town hall fifteen times, and doing yet more programming problems about MEX. So, this is not going to be your ordinary MEX problem. For any positive integer (k), define the (k)-mex of a collection of integers (S) to be the (k)-th smallest nonnegative integer not present in (S). For instance, the (1)-mex and (2)-mex of (1, 2, 1) are (0) and (3), respectively. Let (n) be a positive integer, and consider an array of nonnegative integers (a_1, \ldots, a_n). Compute the number of arrays of nonnegative integers (b_1, \ldots, b_n) such that: For all (1 \leq i \leq n), the ((n-i+1))-mex of (b_1, \ldots, b_i) is (a_i). Additionally, for all (1 \leq i \leq n), (0 \leq b_i \leq n). 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 a single integer (n) ((1 \leq n \leq 2 \cdot 10^5)) — the length of the array (a). The second line of each test case contains (n) integers (a_1, \ldots, a_n) ((0 \leq a_i \leq 10^9)). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single integer — the number of satisfying arrays (b) modulo (10^9 + 7). In the first test case, the array (a = 3, 3, 1). There exist exactly six such arrays (b) that work. One such example is the array (b = 2, 0, 2), which satisfies the conditions because: the (3)-mex of (b_1 = 2) is (a_1 = 3), the (2)-mex of |
| Codeforces Round 1085 (Div. 1 + Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 365887748 | leelaakash_05 | E2 | March 8, 2026, 4:15 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 62 | 0 | ||
| 365934333 | guoziyang | E2 | March 9, 2026, 3:25 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 0 | ||
| 365901643 | Taechka | E2 | March 8, 2026, 5:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 102400 | ||
| 365896750 | BhaiSom23 | E2 | March 8, 2026, 5:05 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 102400 | ||
| 365895109 | Akshat_Agg. | E2 | March 8, 2026, 4:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 102400 | ||
| 365911674 | hiteshjkh | E2 | March 8, 2026, 7:30 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 204800 | ||
| 365891369 | hibye1217 | E2 | March 8, 2026, 4:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 1024000 | ||
| 365897025 | activedeltorre | E2 | March 8, 2026, 5:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 3276800 | ||
| 365891278 | mickeyjung | E2 | March 8, 2026, 4:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 4300800 | ||
| 365885027 | Aeon | E2 | March 8, 2026, 4:01 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 78 | 6041600 | ||
| 365927806 | timg8710 | E2 | March 9, 2026, 12:25 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 102400 | ||
| 365897710 | AtharvIITB | E2 | March 8, 2026, 5:10 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 102400 | ||
| 365896903 | mahiro_zcy | E2 | March 8, 2026, 5:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 102400 | ||
| 365893739 | nguyenducleminh02 | E2 | March 8, 2026, 4:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 102400 | ||
| 365884119 | Ormlis | E2 | March 8, 2026, 3:57 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 102400 | ||
| 365895202 | makeba2505 | E2 | March 8, 2026, 4:56 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 614400 | ||
| 365904343 | ahsoltan | E2 | March 8, 2026, 6:02 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 819200 | ||
| 365896980 | PelicanPilot | E2 | March 8, 2026, 5:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 819200 | ||
| 365912636 | marc2825 | E2 | March 8, 2026, 7:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 1024000 | ||
| 365900623 | FelixMP | E2 | March 8, 2026, 5:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 62 | 1024000 | ||
| 365892491 | permutation | E2 | March 8, 2026, 4:40 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 102400 | ||
| 365881797 | maspy | E2 | March 8, 2026, 3:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 2252800 | ||
| 365943712 | riacn | E2 | March 9, 2026, 6:07 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365934261 | gopal.thecoder | E2 | March 9, 2026, 3:24 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365918135 | A_G | E2 | March 8, 2026, 8:52 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365914652 | va1bh3v | E2 | March 8, 2026, 8:06 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365905191 | GP117 | E2 | March 8, 2026, 6:11 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365900779 | pentaproton | E2 | March 8, 2026, 5:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365895103 | zidder | E2 | March 8, 2026, 4:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365895052 | kode___code9973 | E2 | March 8, 2026, 4:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 62 | 0 | ||
| 365899697 | EgeeReyZee | E2 | March 8, 2026, 5:22 p.m. | OK | GNU C11 | TESTS | 15 | 78 | 921600 | ||
| 365882388 | zitity | E2 | March 8, 2026, 3:49 p.m. | OK | GNU C11 | TESTS | 15 | 93 | 4812800 | ||
| 365891010 | jdltc | E2 | March 8, 2026, 4:32 p.m. | OK | Java 21 | TESTS | 15 | 265 | 1228800 | ||
| 365891095 | the_atul_gour | E2 | March 8, 2026, 4:32 p.m. | OK | Java 21 | TESTS | 15 | 265 | 1536000 | ||
| 365900185 | vinamrat4 | E2 | March 8, 2026, 5:24 p.m. | OK | Java 21 | TESTS | 15 | 375 | 16384000 | ||
| 365894385 | SCORPION8X | E2 | March 8, 2026, 4:51 p.m. | OK | Java 21 | TESTS | 15 | 437 | 3993600 | ||
| 365881569 | Tlatoani | E2 | March 8, 2026, 3:45 p.m. | OK | Kotlin 2.2 | TESTS | 15 | 281 | 38604800 | ||
| 365891960 | SanjarAlgo | E2 | March 8, 2026, 4:37 p.m. | OK | PascalABC.NET | TESTS | 15 | 312 | 5120000 | ||
| 365898193 | Ergodic137 | E2 | March 8, 2026, 5:13 p.m. | OK | PyPy 3-64 | TESTS | 15 | 125 | 25804800 | ||
| 365901743 | bhavinsg02 | E2 | March 8, 2026, 5:33 p.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 25190400 | ||
| 365892785 | vijayguhan5 | E2 | March 8, 2026, 4:42 p.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 29696000 | ||
| 365896985 | ZiadMohamedGamal_25 | E2 | March 8, 2026, 5:06 p.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 37068800 | ||
| 365898037 | Only365 | E2 | March 8, 2026, 5:12 p.m. | OK | PyPy 3-64 | TESTS | 15 | 156 | 25088000 | ||
| 365901605 | dyppp | E2 | March 8, 2026, 5:32 p.m. | OK | PyPy 3-64 | TESTS | 15 | 156 | 26931200 | ||
| 365890914 | LeonVir | E2 | March 8, 2026, 4:31 p.m. | OK | PyPy 3-64 | TESTS | 15 | 156 | 28160000 | ||
| 365896904 | codename_25 | E2 | March 8, 2026, 5:06 p.m. | OK | PyPy 3-64 | TESTS | 15 | 156 | 37068800 | ||
| 365895087 | mihailzinakovvv | E2 | March 8, 2026, 4:55 p.m. | OK | PyPy 3-64 | TESTS | 15 | 171 | 26828800 | ||
| 365885546 | golomb | E2 | March 8, 2026, 4:04 p.m. | OK | PyPy 3-64 | TESTS | 15 | 187 | 21401600 | ||
| 365895534 | P.srinivas | E2 | March 8, 2026, 4:58 p.m. | OK | Python 3 | TESTS | 15 | 312 | 38195200 | ||
| 365891562 | hachiko2026 | E2 | March 8, 2026, 4:35 p.m. | OK | Ruby 3 | TESTS | 15 | 437 | 40550400 | ||
| 365890008 | Sugar_fan | E2 | March 8, 2026, 4:27 p.m. | OK | Rust 2024 | TESTS | 15 | 46 | 14950400 | ||
| 365888780 | Darknef | E2 | March 8, 2026, 4:20 p.m. | OK | Rust 2024 | TESTS | 15 | 46 | 18841600 | ||
| 365898122 | DanielAnker | E2 | March 8, 2026, 5:12 p.m. | OK | Rust 2024 | TESTS | 15 | 93 | 18739200 |
Back to search problems