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 |
|---|---|---|---|---|---|---|
| 2122 | Order Capital Round 1 (Codeforces Round 1038, Div. 1 + Div. 2) | FINISHED | False | 8100 | 23469923 | July 19, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1060 ) | E | Greedy Grid Counting | PROGRAMMING | dp greedy math |
A path in a grid is called greedy if it starts at the top-left cell and moves only to the right or downward, always moving to its neighbor with the greater value (or either if the values are equal). The value of a path is the sum of the values of the cells it visits, including the start and end. Given a partially filled (2 \times n) grid of integers between (1) and (k), count the number of ways to fill the empty cells such that in every subgrid (^{\text{∗}}), there exists a greedy path that achieves the maximum value out of all down/right paths. Since the answer may be large, calculate it modulo (998\,244\,353). (^{\text{∗}}) A subgrid of a (2 \times n) grid (a_{i,j}) is a grid formed from all cells (a_{x,y}) such that (l_x \leq x \leq r_x), (l_y \leq y \leq r_y) for some (1 \leq l_x \leq r_x \leq 2), (1 \leq l_y \leq r_y \leq n). 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 test case contains two integers (n) and (k) ((1 \leq n, k \leq 500)) — the number of columns and the range of integers in the grid, respectively. Then two lines follow, the (i)-th line containing (n) integers (a_{i,1}, a_{i,2}, \ldots, a_{i,n}) ((-1 \leq a_{i,j} \leq k), (a_{i,j} \neq 0)) — the values of cells in the (i)-th row of the grid, where (-1) represents an empty cell. It is guaranteed that the sum of (n) over all test cases does not exceed (500). For each test case, output a single integer — the number of ways to fill the grid that satisfy the above conditions, modulo (998\,244\,353). In the first test case, the grids that satisfy the conditions are: () \begin{bmatrix} 2 & 1 & 1 & 2 \\ 2 & 1 & 1 & 3 \end{bmatrix},\: \begin{bmatrix} 2 & 1 & 1 & 2 \\ 2 & 2 & 1 & 3 \end{bmatrix},\: \begin{bmatrix} 2 & 1 & 1 & 2 \\ 2 & 3 & 1 & 3 \end{ |
| Order Capital Round 1 (Codeforces Round 1038, 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 329871569 | opia | E | July 19, 2025, 4:35 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 108 | 102400 | ||
| 329895073 | Rshishabh_Yadav | E | July 19, 2025, 7:19 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 218 | 102400 | ||
| 329881167 | Nika533 | E | July 19, 2025, 5:19 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 390 | 24064000 | ||
| 329886335 | rflash | E | July 19, 2025, 5:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 656 | 15564800 | ||
| 329922132 | cjsyc | E | July 20, 2025, 4:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 686 | 102400 | ||
| 329884386 | akulsareen | E | July 19, 2025, 5:41 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 734 | 6451200 | ||
| 329872267 | juniorr | E | July 19, 2025, 4:36 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 765 | 102400 | ||
| 329883120 | Kinan_26 | E | July 19, 2025, 5:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 780 | 1024000 | ||
| 329882889 | _Fake4Fun | E | July 19, 2025, 5:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 796 | 1024000 | ||
| 329913008 | hzk_cpp | E | July 20, 2025, 1:27 a.m. | OK | C++17 (GCC 7-32) | TESTS | 29 | 796 | 1126400 | ||
| 329923698 | Warma | E | July 20, 2025, 4:39 a.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 61 | 102400 | ||
| 329891720 | surajchip2 | E | July 19, 2025, 6:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 62 | 102400 | ||
| 329923592 | Warma | E | July 20, 2025, 4:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 109 | 102400 | ||
| 329917608 | _wrz_ | E | July 20, 2025, 3 a.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 156 | 102400 | ||
| 329891292 | surajchip2 | E | July 19, 2025, 6:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 171 | 102400 | ||
| 329891249 | surajchip2 | E | July 19, 2025, 6:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 202 | 102400 | ||
| 329881482 | kenkenken | E | July 19, 2025, 5:21 p.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 218 | 102400 | ||
| 329868836 | _istil | E | July 19, 2025, 4:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 233 | 1024000 | ||
| 329927770 | hshhh_ | E | July 20, 2025, 5:36 a.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 234 | 102400 | ||
| 329918264 | awerty_noob | E | July 20, 2025, 3:11 a.m. | OK | C++20 (GCC 13-64) | TESTS | 29 | 249 | 102400 | ||
| 329916909 | yoru_sacri | E | July 20, 2025, 2:48 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 46 | 102400 | ||
| 329876584 | JDScript0117 | E | July 19, 2025, 4:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 46 | 1024000 | ||
| 329904176 | andrewgopher | E | July 19, 2025, 9:35 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 46 | 2969600 | ||
| 329911740 | catgirl | E | July 20, 2025, 12:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 62 | 102400 | ||
| 329869262 | Dalek_of_Rivia | E | July 19, 2025, 4:29 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 62 | 102400 | ||
| 329919604 | ATRIQAQ | E | July 20, 2025, 3:33 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 125 | 2150400 | ||
| 329894175 | BLOBVISGOD | E | July 19, 2025, 7:08 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 140 | 102400 | ||
| 329877965 | MtSaka | E | July 19, 2025, 4:48 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 171 | 409600 | ||
| 329880918 | Anoth3r | E | July 19, 2025, 5:18 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 186 | 102400 | ||
| 329870872 | zidder | E | July 19, 2025, 4:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 29 | 202 | 3072000 | ||
| 329882797 | Gassa | E | July 19, 2025, 5:30 p.m. | OK | D | TESTS | 29 | 2843 | 3379200 | ||
| 329870023 | rainboy | E | July 19, 2025, 4:31 p.m. | OK | GNU C11 | TESTS | 29 | 1718 | 1126400 | ||
| 329874765 | Dominion948 | E | July 19, 2025, 4:42 p.m. | OK | Go | TESTS | 29 | 577 | 4403200 | ||
| 329927825 | Little_Sheep_Yawn | E | July 20, 2025, 5:37 a.m. | OK | PyPy 3-64 | TESTS | 29 | 952 | 9011200 | ||
| 329923817 | shanks_jr10 | E | July 20, 2025, 4:41 a.m. | OK | PyPy 3-64 | TESTS | 29 | 1327 | 7065600 | ||
| 329906908 | Ayis137 | E | July 19, 2025, 10:11 p.m. | OK | PyPy 3-64 | TESTS | 29 | 1921 | 4710400 | ||
| 329887178 | twosquares | E | July 19, 2025, 6:02 p.m. | OK | PyPy 3-64 | TESTS | 29 | 2968 | 9728000 | ||
| 329871350 | Ming_Xu | E | July 19, 2025, 4:34 p.m. | OK | Rust 2021 | TESTS | 29 | 452 | 102400 |
Back to search problems