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 |
|---|---|---|---|---|---|---|
| 2146 | Codeforces Round 1052 (Div. 2) | FINISHED | False | 8100 | 17940323 | Sept. 21, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 298 ) | F | Bubble Sort | PROGRAMMING | brute force combinatorics dp |
You have just learned the algorithm bubble sort , which is able to sort an array in non-descending order. Let's define the function (\text{sort}(a)) as in the following pseudocode: As it is shown, the return value of (\text{sort}(a)) represents the number of rounds needed to make array (a) sorted in non-descending order by using bubble sort . You are given an integer (n), as well as (m) integer tuples ((k_i,l_i,r_i)) ((1\le i\le m)). Count the number of permutations(^{\text{∗}}) (p) of length (n), modulo (998\,244\,353), so that the following restrictions are satisfied: For each (1\le i\le n), let (b_i=\text{sort}(p_1,p_2,\ldots,p_{i})), then For each (1\le j\le m), let (x) be the number of indices (y) ((1\le y\le n)) such that (b_y\le k_j), then (l_j\le x\le r_j) holds. (^{\text{∗}})A permutation of length (n) is an array consisting of (n) distinct integers from (1) to (n) in arbitrary order. For example, (2,3,1,5,4) is a permutation, but (1,2,2) is not a permutation ((2) appears twice in the array), and (1,3,4) is also not a permutation ((n=3) but there is (4) in the array). 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 two integers (n) and (m) ((2\leq n\leq 10^6), (0\leq m\leq 1000)). Then (m) lines follow, the (i)-th line containing three integers (k_i), (l_i), and (r_i) ((0\le k_i\le n - 1), (1\le l_i\le r_i\le n)) — the restrictions. It is guaranteed that the sum of (m^2) over all test cases does not exceed (10^6). For each test case, output a single integer — the number of possible permutations, modulo (998\,244\,353). In the first test case, only permutations (3,1,4,2) and (4,1,3,2) satisfy the re |
| Codeforces Round 1052 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 339813389 | AA-2007 | F | Sept. 22, 2025, 12:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 24 | 296 | 16896000 | ||
| 339834168 | Geclus | F | Sept. 22, 2025, 5:53 a.m. | OK | C++17 (GCC 7-32) | TESTS | 24 | 671 | 16076800 | ||
| 339789695 | Az3ar | F | Sept. 21, 2025, 5:36 p.m. | OK | C++17 (GCC 7-32) | TESTS | 24 | 687 | 7987200 | ||
| 339790553 | CTHOOH | F | Sept. 21, 2025, 5:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 109 | 50073600 | ||
| 339821707 | newbie114514 | F | Sept. 22, 2025, 3:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 156 | 40345600 | ||
| 339819374 | Leo_W | F | Sept. 22, 2025, 2:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 171 | 41574400 | ||
| 339831442 | yeminghan | F | Sept. 22, 2025, 5:24 a.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 187 | 16179200 | ||
| 339810045 | Terrorb1ade | F | Sept. 21, 2025, 10:58 p.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 218 | 40243200 | ||
| 339773313 | BurnedChicken | F | Sept. 21, 2025, 4:18 p.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 234 | 8192000 | ||
| 339820411 | old_man_die_hard | F | Sept. 22, 2025, 2:51 a.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 249 | 12185600 | ||
| 339780517 | abc864197532 | F | Sept. 21, 2025, 4:38 p.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 265 | 16998400 | ||
| 339818353 | NKheyuxiang | F | Sept. 22, 2025, 2:23 a.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 265 | 32153600 | ||
| 339811170 | Caylex | F | Sept. 21, 2025, 11:42 p.m. | OK | C++20 (GCC 13-64) | TESTS | 24 | 296 | 67686400 | ||
| 339828826 | autumoon | F | Sept. 22, 2025, 4:54 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 171 | 75776000 | ||
| 339828743 | weakpyt | F | Sept. 22, 2025, 4:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 171 | 75776000 | ||
| 339833142 | ali2005_syr | F | Sept. 22, 2025, 5:41 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 186 | 16076800 | ||
| 339832576 | balancing | F | Sept. 22, 2025, 5:35 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 187 | 8089600 | ||
| 339813294 | MultiverseMadness | F | Sept. 22, 2025, 12:53 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 203 | 48230400 | ||
| 339777711 | Petra_A | F | Sept. 21, 2025, 4:30 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 218 | 8089600 | ||
| 339829293 | Warturtle | F | Sept. 22, 2025, 5 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 233 | 48332800 | ||
| 339806132 | Krish-Sehgal | F | Sept. 21, 2025, 9:02 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 234 | 48230400 | ||
| 339782727 | JDScript0117 | F | Sept. 21, 2025, 4:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 249 | 12083200 | ||
| 339790141 | vedantkohad | F | Sept. 21, 2025, 5:39 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 24 | 249 | 48332800 | ||
| 339827165 | Ab_hoga_real_Cumback | F | Sept. 22, 2025, 4:28 a.m. | OK | Java 21 | TESTS | 24 | 1890 | 214220800 | ||
| 339795524 | Nikrien | F | Sept. 21, 2025, 6:27 p.m. | OK | PyPy 3-64 | TESTS | 24 | 296 | 47206400 | ||
| 339827739 | zouyu9631 | F | Sept. 22, 2025, 4:36 a.m. | OK | PyPy 3-64 | TESTS | 24 | 499 | 46284800 | ||
| 339810359 | RonnieChen | F | Sept. 21, 2025, 11:11 p.m. | OK | PyPy 3-64 | TESTS | 24 | 515 | 25088000 |
Back to search problems