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 |
|---|---|---|---|---|---|---|
| 2084 | Teza Round 1 (Codeforces Round 1015, Div. 1 + Div. 2) | FINISHED | False | 10800 | 32887488 | April 5, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1755 ) | E | Blossom | PROGRAMMING | combinatorics fft math |
You are given a permutation (a) of length (n)(^{\text{∗}}) where some elements are missing and represented by (-1). Define the value of a permutation as the sum of the MEX(^{\text{†}}) of all its non-empty subsegments(^{\text{‡}}). Find the sum of the value of all possible valid permutations that can be formed by filling in the missing elements of (a) modulo (10^9 + 7). (^{\text{∗}}) A permutation of length (n) is an array consisting of (n) distinct integers from (\bf{0}) to (\bf{n - 1}) in arbitrary order. For example, (1,2,0,4,3) is a permutation, but (0,1,1) is not a permutation ((1) appears twice in the array), and (0,2,3) is also not a permutation ((n=3) but there is (3) in the array). (^{\text{†}})The minimum excluded (MEX) of a collection of integers (c_1, c_2, \ldots, c_k) is defined as the smallest non-negative integer (x) which does not occur in the collection (c). (^{\text{‡}})A sequence (a) is a subsegment of a sequence (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 5000)). The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((-1 \le a_i < n)). It is guaranteed that the elements of (a) that are not (-1) are distinct. It is guaranteed that the sum of (n) over all test cases does not exceed (5000). For each test case, output a single integer — the sum of the value of all possible valid permutations modulo (10^9 + 7). In the first test case, the only valid permutation is (0, 1), and the value of (0, 1) is $$ |
| 141155 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 314191700 | btoandizi | E | April 6, 2025, 3:59 a.m. | OK | C# 10 | TESTS | 25 | 2031 | 411136000 | ||
| 314146924 | Handsome2004 | E | April 5, 2025, 5:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 312 | 307200 | ||
| 314165913 | kaka_haha | E | April 5, 2025, 7:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 374 | 102400 | ||
| 314149259 | kalimm | E | April 5, 2025, 5:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 453 | 200908800 | ||
| 314185363 | lnw143 | E | April 6, 2025, 1:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 468 | 204800 | ||
| 314154113 | konbi | E | April 5, 2025, 5:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 577 | 1638400 | ||
| 314158998 | Darko1 | E | April 5, 2025, 6:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 640 | 204800 | ||
| 314149790 | FattyPenguin | E | April 5, 2025, 5:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 671 | 102400 | ||
| 314193748 | fantis | E | April 6, 2025, 4:33 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 671 | 201011200 | ||
| 314144398 | padmendray30 | E | April 5, 2025, 5 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 687 | 0 | ||
| 314188431 | 2021sjz | E | April 6, 2025, 2:58 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 687 | 100556800 | ||
| 314187442 | 2018LZY | E | April 6, 2025, 2:39 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 140 | 204800 | ||
| 314150090 | omnitrixx | E | April 5, 2025, 5:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 171 | 102400 | ||
| 314184976 | fydj | E | April 6, 2025, 1:45 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 171 | 2355200 | ||
| 314170774 | justin_zed | E | April 5, 2025, 8:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 187 | 102400 | ||
| 314193350 | kulovemi | E | April 6, 2025, 4:27 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 202 | 102400 | ||
| 314148823 | zawatin | E | April 5, 2025, 5:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 202 | 102400 | ||
| 314201512 | lprdsb | E | April 6, 2025, 6:05 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 203 | 123187200 | ||
| 314186030 | Lsince_yx | E | April 6, 2025, 2:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 218 | 204800 | ||
| 314151421 | nanani | E | April 5, 2025, 5:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 249 | 102400 | ||
| 314158974 | lucky_clover_ | E | April 5, 2025, 6:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 249 | 204800 | ||
| 314159885 | swaha | E | April 5, 2025, 6:38 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 124 | 102400 | ||
| 314153893 | sususiesss | E | April 5, 2025, 5:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 124 | 102400 | ||
| 314146079 | alexwice | E | April 5, 2025, 5:06 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 125 | 102400 | ||
| 314187674 | human.exe | E | April 6, 2025, 2:43 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 140 | 204800 | ||
| 314152943 | cbdsopa | E | April 5, 2025, 5:29 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 140 | 204800 | ||
| 314196451 | 424479543 | E | April 6, 2025, 5:12 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 156 | 3788800 | ||
| 314159629 | Abraxos | E | April 5, 2025, 6:36 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 171 | 204800 | ||
| 314159791 | 424479543 | E | April 5, 2025, 6:37 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 186 | 3788800 | ||
| 314193989 | kolomig0r | E | April 6, 2025, 4:37 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 187 | 102400 | ||
| 314159259 | postpone | E | April 5, 2025, 6:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 25 | 218 | 0 | ||
| 314199297 | ahmedafeef | E | April 6, 2025, 5:43 a.m. | OK | GNU C11 | TESTS | 25 | 1655 | 401715200 | ||
| 314199010 | ahmedafeef | E | April 6, 2025, 5:40 a.m. | OK | GNU C11 | TESTS | 25 | 1655 | 401715200 | ||
| 314196081 | ahmedafeef | E | April 6, 2025, 5:07 a.m. | OK | GNU C11 | TESTS | 25 | 1655 | 401715200 | ||
| 314146460 | Dominion948 | E | April 5, 2025, 5:07 p.m. | OK | Go | TESTS | 25 | 2328 | 436531200 | ||
| 314153966 | Tlatoani | E | April 5, 2025, 5:32 p.m. | OK | Kotlin 1.9 | TESTS | 25 | 2249 | 445132800 | ||
| 314153330 | eepsilon | E | April 5, 2025, 5:30 p.m. | OK | PyPy 3-64 | TESTS | 25 | 780 | 5222400 | ||
| 314159145 | Proelectro444 | E | April 5, 2025, 6:32 p.m. | OK | PyPy 3-64 | TESTS | 25 | 1733 | 8499200 | ||
| 314170680 | LMeyling | E | April 5, 2025, 8:28 p.m. | OK | PyPy 3-64 | TESTS | 25 | 2921 | 225996800 | ||
| 314142541 | nikoro256 | E | April 5, 2025, 4:54 p.m. | OK | PyPy 3-64 | TESTS | 25 | 3718 | 279142400 | ||
| 314143209 | DanielAnker | E | April 5, 2025, 4:56 p.m. | OK | Rust 2021 | TESTS | 25 | 1202 | 297779200 | ||
| 314192048 | btoandizi | E | April 6, 2025, 4:06 a.m. | OK | Rust 2021 | TESTS | 25 | 1936 | 398336000 |
Back to search problems