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 |
|---|---|---|---|---|---|---|
| 2208 | Codeforces Round 1086 (Div. 2) | FINISHED | False | 7200 | 2906723 | March 14, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 401 ) | E | Counting Cute Arrays | PROGRAMMING | combinatorics dp |
Let (A_1, A_2, \ldots, A_n) be an array of (n) positive integers. Define array (f(A)) as followed: For each integer (i) from (1) to (n): If there exists integer (j) such that (j \lt i) and (A_j \lt A_i), (f(A)_i=\max\limits_{j \lt i,A_j \lt A_i} j). That is, (f(A)_i) is the index of the rightmost element before (i) whose value is strictly smaller than (A_i). Otherwise (f(A)_i=0). We call the array (P_1,P_2,\ldots,P_n) of non-negative integers a cute array if there exists an array (A) such that (f(A)=P). Given a length (n) array (X) in which (-1\le X_i\le n) holds for all (i) from (1) to (n). Count the numbers of cute arrays (X') formed by replacing the (-1)s in (X) with integers from (0) to (n). As the number can be very large, print it modulo (998\,244\,353). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test cases contain an integer (n) ((1\le n\le5000)) denoting the length of (X). The second line contain (n) integers (X_1,X_2,\ldots,X_n) ((-1\le X_i\le n)). It is guaranteed that the sum of (n) over all test cases does not exceed (5000). For each test cases, output a single integer denoting the number of arrays (X') such that (X') is a cute array, modulo (998\,244\,353). For the first test case, only (0,0,0) and (0,0,2) are cute arrays among all possible (X'). (0,0,0) is a good cute array because (f(1,1,1)=0,0,0), and (0,0,2) is a good array because (f(1,1,2)=0,0,2). For the second test case, only (0,1,1,0), (0,1,1,1) and (0,1,1,3) are cute arrays among all possible (X'). |
| Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 366715871 | _annhien_ruby22 | E | March 14, 2026, 5:39 p.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 46 | 102400 | ||
| 366708224 | Faisal1R | E | March 14, 2026, 4:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 46 | 102400 | ||
| 366706937 | f.h.rakib02 | E | March 14, 2026, 4:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 46 | 102400 | ||
| 366702403 | Debjit_12212332 | E | March 14, 2026, 4:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 62 | 102400 | ||
| 366713617 | Umedjon_2013 | E | March 14, 2026, 5:22 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 78 | 102400 | ||
| 366703638 | xyxyz | E | March 14, 2026, 4:21 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 93 | 0 | ||
| 366700778 | Prof.nlogn | E | March 14, 2026, 4:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 93 | 102400 | ||
| 366762810 | karry112 | E | March 15, 2026, 5:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 93 | 47104000 | ||
| 366748010 | rlakkh | E | March 15, 2026, 1:35 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 109 | 0 | ||
| 366750836 | kevinyu | E | March 15, 2026, 2:38 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 125 | 0 | ||
| 366745589 | thisislike_fan | E | March 15, 2026, 12:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 46 | 0 | ||
| 366759003 | wabca | E | March 15, 2026, 5:05 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 46 | 102400 | ||
| 366708157 | vld.ktk | E | March 14, 2026, 4:31 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 102400 | ||
| 366714290 | Acheronlt | E | March 14, 2026, 5:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 62 | 102400 | ||
| 366708050 | DNR | E | March 14, 2026, 4:31 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 78 | 96870400 | ||
| 366718957 | siganai | E | March 14, 2026, 6:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 78 | 96972800 | ||
| 366747597 | AILevel | E | March 15, 2026, 1:25 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 93 | 102400 | ||
| 366700106 | superguymj | E | March 14, 2026, 4:12 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 93 | 102400 | ||
| 366742573 | TKT_YI | E | March 14, 2026, 11:23 p.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 93 | 47206400 | ||
| 366712777 | ahsoltan | E | March 14, 2026, 5:17 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 93 | 204492800 | ||
| 366745037 | oohyees | E | March 15, 2026, 12:14 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 46 | 0 | ||
| 366763392 | diya__ | E | March 15, 2026, 5:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 46 | 102400 | ||
| 366746036 | onekeys | E | March 15, 2026, 12:42 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 46 | 102400 | ||
| 366739759 | vinayak106mahindrakar | E | March 14, 2026, 10:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 46 | 102400 | ||
| 366712967 | Dispensable | E | March 14, 2026, 5:18 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 46 | 102400 | ||
| 366709478 | Conqueror5 | E | March 14, 2026, 4:34 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 46 | 102400 | ||
| 366708608 | gleb.astashkin | E | March 14, 2026, 4:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 46 | 102400 | ||
| 366705424 | ramcharan0014 | E | March 14, 2026, 4:25 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 46 | 102400 | ||
| 366746324 | oohyees | E | March 15, 2026, 12:50 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 62 | 102400 | ||
| 366709229 | vlp | E | March 14, 2026, 4:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 62 | 102400 | ||
| 366754905 | buitS | E | March 15, 2026, 3:57 a.m. | OK | Java 21 | TESTS | 42 | 234 | 819200 | ||
| 366726913 | rachit.gupta | E | March 14, 2026, 7:20 p.m. | OK | Java 21 | TESTS | 42 | 500 | 512000 | ||
| 366726567 | shubhansh_gupta | E | March 14, 2026, 7:17 p.m. | OK | Java 21 | TESTS | 42 | 500 | 512000 | ||
| 366707313 | dark_slayer007 | E | March 14, 2026, 4:29 p.m. | OK | Java 8 | TESTS | 40 | 609 | 0 | ||
| 366705359 | Ravnik | E | March 14, 2026, 4:25 p.m. | OK | Rust 2024 | TESTS | 40 | 62 | 11776000 |
Back to search problems