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 |
|---|---|---|---|---|---|---|
| 2138 | Codeforces Round 1048 (Div. 1) | FINISHED | False | 10800 | 19063523 | Sept. 8, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 5298 ) | B | Antiamuny Wants to Learn Swap | PROGRAMMING | data structures greedy |
For an array (b) of length (m), you may perform the following two operations: Select an index (1\le i\le m - 1). Then, swap the values of (b_i) and (b_{i + 1}). Select an index (1\le i\le m - 2). Then, swap the values of (b_i) and (b_{i + 2}). We define (f(b)) as the minimum number of operations (using both operation 1 and operation 2) required to sort array (b) in non-decreasing order, and (g(b)) as the minimum number of operations required to sort array (b) in non-decreasing order using only operation 1 . The array (b) is perfect if (f(b) = g(b)). In other words, the ability to use operation 2 does not reduce the number of operations required to sort array (b) compared to using only adjacent swaps. You are given a permutation (a) of length (n)(^{\text{∗}}), and must answer (q) queries. Each query consists of two integers (l) and (r) ((1\le l\le r\le n)), representing the subarray (al\ldots r)(^{\text{†}}). For each query, determine whether the subarray (al\ldots r) is perfect. (^{\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). (^{\text{†}})The subarray (al\ldots r) includes all elements from index (l) to (r), i.e., (a_l, a_{l + 1}, a_{l + 2}, \ldots, a_r). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 5 \cdot 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n), (q) ((1 \le n, q \le 5 \cdot 10^5)) — the length of array (a) and the number of queries. The second line of each test case c |
| Codeforces Round 1048 (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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 337679801 | Broder | B | Sept. 8, 2025, 10:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 343 | 4198400 | ||
| 337680560 | Broder | B | Sept. 8, 2025, 10:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 359 | 4198400 | ||
| 337609161 | Cruelworld | B | Sept. 8, 2025, 3:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 374 | 20070400 | ||
| 337681720 | Luminous2009 | B | Sept. 8, 2025, 11:13 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 389 | 4096000 | ||
| 337596070 | SaltyDonut | B | Sept. 8, 2025, 3:12 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 405 | 4198400 | ||
| 337660499 | weebyes | B | Sept. 8, 2025, 5:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 405 | 6144000 | ||
| 337658802 | che960 | B | Sept. 8, 2025, 5:29 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 405 | 8089600 | ||
| 337591620 | Hasanv | B | Sept. 8, 2025, 3:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 406 | 4096000 | ||
| 337686710 | wifiiii | B | Sept. 9, 2025, 1:20 a.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 421 | 14438400 | ||
| 337591525 | Sorting | B | Sept. 8, 2025, 3:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 31 | 437 | 4505600 | ||
| 337606298 | max0810 | B | Sept. 8, 2025, 3:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 140 | 12185600 | ||
| 337697832 | 3alam | B | Sept. 9, 2025, 4:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 281 | 4198400 | ||
| 337678282 | zsombor | B | Sept. 8, 2025, 9:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 296 | 5734400 | ||
| 337570743 | gamegame | B | Sept. 8, 2025, 2:44 p.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 296 | 32153600 | ||
| 337694007 | _Akuma | B | Sept. 9, 2025, 3:20 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 311 | 4198400 | ||
| 337684792 | Misty7 | B | Sept. 9, 2025, 12:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 311 | 8396800 | ||
| 337700300 | random1810 | B | Sept. 9, 2025, 4:55 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 312 | 4198400 | ||
| 337686216 | NotOnlySuccess | B | Sept. 9, 2025, 1:09 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 312 | 4198400 | ||
| 337582709 | mo_onrabbit2 | B | Sept. 8, 2025, 2:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 312 | 7987200 | ||
| 337581396 | 244mhq | B | Sept. 8, 2025, 2:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 312 | 10035200 | ||
| 337673914 | plagues | B | Sept. 8, 2025, 8:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 108 | 23142400 | ||
| 337673126 | plagues | B | Sept. 8, 2025, 8:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 108 | 113356800 | ||
| 337673907 | plagues | B | Sept. 8, 2025, 8:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 124 | 23142400 | ||
| 337673820 | plagues | B | Sept. 8, 2025, 8:19 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 124 | 23142400 | ||
| 337673040 | plagues | B | Sept. 8, 2025, 8:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 124 | 33177600 | ||
| 337673116 | plagues | B | Sept. 8, 2025, 8:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 139 | 113356800 | ||
| 337582212 | exgcd | B | Sept. 8, 2025, 2:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 155 | 4300800 | ||
| 337672739 | plagues | B | Sept. 8, 2025, 8:04 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 249 | 44544000 | ||
| 337584647 | 26100154 | B | Sept. 8, 2025, 2:57 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 281 | 17510400 | ||
| 337680096 | UFEQ | B | Sept. 8, 2025, 10:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 296 | 4300800 | ||
| 337614384 | pengin_2000 | B | Sept. 8, 2025, 3:42 p.m. | OK | GNU C11 | TESTS | 31 | 718 | 32153600 | ||
| 337696260 | oishiki22 | B | Sept. 9, 2025, 3:53 a.m. | OK | Java 21 | TESTS | 31 | 999 | 10035200 | ||
| 337627721 | MaxBuzz | B | Sept. 8, 2025, 4:07 p.m. | OK | Java 21 | TESTS | 31 | 1358 | 21913600 | ||
| 337705421 | keshav_.agg | B | Sept. 9, 2025, 5:59 a.m. | OK | Java 21 | TESTS | 31 | 1531 | 50380800 | ||
| 337595225 | golions | B | Sept. 8, 2025, 3:11 p.m. | OK | Java 8 | TESTS | 31 | 1186 | 12083200 | ||
| 337621342 | omdeshmukh1906 | B | Sept. 8, 2025, 3:55 p.m. | OK | Java 8 | TESTS | 31 | 1358 | 45568000 | ||
| 337594232 | Tlatoani | B | Sept. 8, 2025, 3:10 p.m. | OK | Kotlin 2.2 | TESTS | 31 | 1374 | 55910400 | ||
| 337589311 | eepsilon | B | Sept. 8, 2025, 3:03 p.m. | OK | PyPy 3-64 | TESTS | 31 | 515 | 67584000 | ||
| 337607600 | ow3nL | B | Sept. 8, 2025, 3:30 p.m. | OK | PyPy 3-64 | TESTS | 31 | 562 | 66560000 | ||
| 337622458 | 987 | B | Sept. 8, 2025, 3:57 p.m. | OK | PyPy 3-64 | TESTS | 31 | 608 | 60313600 | ||
| 337579126 | dyppp | B | Sept. 8, 2025, 2:51 p.m. | OK | PyPy 3-64 | TESTS | 31 | 624 | 65638400 | ||
| 337684432 | alexwice | B | Sept. 9, 2025, 12:30 a.m. | OK | PyPy 3-64 | TESTS | 31 | 687 | 93388800 | ||
| 337596717 | Alex239 | B | Sept. 8, 2025, 3:13 p.m. | OK | PyPy 3-64 | TESTS | 31 | 733 | 72499200 | ||
| 337691235 | Little_Sheep_Yawn | B | Sept. 9, 2025, 2:40 a.m. | OK | PyPy 3-64 | TESTS | 31 | 858 | 67686400 | ||
| 337607170 | Mukundan314 | B | Sept. 8, 2025, 3:29 p.m. | OK | PyPy 3-64 | TESTS | 31 | 1468 | 74956800 | ||
| 337644591 | toam | B | Sept. 8, 2025, 4:47 p.m. | OK | PyPy 3-64 | TESTS | 31 | 1796 | 102912000 | ||
| 337605243 | Z_actuary | B | Sept. 8, 2025, 3:26 p.m. | OK | PyPy 3-64 | TESTS | 31 | 1874 | 152576000 | ||
| 337589070 | sansen | B | Sept. 8, 2025, 3:03 p.m. | OK | Rust 2021 | TESTS | 31 | 577 | 61849600 | ||
| 337579326 | Sugar_fan | B | Sept. 8, 2025, 2:52 p.m. | OK | Rust 2024 | TESTS | 31 | 421 | 108544000 | ||
| 337619658 | WaterColor2037 | B | Sept. 8, 2025, 3:51 p.m. | OK | Rust 2024 | TESTS | 31 | 1515 | 87961600 |
Back to search problems