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 |
|---|---|---|---|---|---|---|
| 2060 | Codeforces Round 998 (Div. 3) | FINISHED | False | 9000 | 39108323 | Jan. 19, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1280 ) | G | Bugged Sort | PROGRAMMING | dp greedy sortings |
Today, Alice has given Bob arrays for him to sort in increasing order again! At this point, no one really knows how many times she has done this. Bob is given two sequences (a) and (b), both of length (n). All integers in the range from (1) to (2n) appear exactly once in either (a) or (b). In other words, the concatenated(^{\text{∗}}) sequence (a+b) is a permutation(^{\text{†}}) of length (2n). Bob must sort both sequences in increasing order at the same time using Alice's swap function. Alice's swap function is implemented as follows: Given two indices (i) and (j) ((i \neq j)), it swaps (a_i) with (b_j), and swaps (b_i) with (a_j). Given sequences (a) and (b), please determine if both sequences can be sorted in increasing order simultaneously after using Alice's swap function any number of times. (^{\text{∗}})The concatenated sequence (a+b) denotes the sequence (a_1, a_2, a_3, \ldots , b_1, b_2, b_3, \ldots). (^{\text{†}})A permutation of length (m) contains all integers from (1) to (m) in some order. 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 a single integer (n) ((3 \le n \le 2 \cdot 10^5)). The second line of each test case contains (a_1,a_2,\ldots,a_n) ((1 \le a_i \le 2n)). The third line of each test case contains (b_1,b_2,\ldots,b_n) ((1 \le b_i \le 2n)). It is guaranteed that all integers in the range (1,2n) appear exactly once in either (a) or (b). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). If it is possible to sort both sequences simultaneously, print " YES " on a new line. Otherwise, print " NO " on a new line. You can output the answer in any case. For example, the strings " yEs ", " |
| Codeforces Round 998 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 301923949 | ezluci | G | Jan. 19, 2025, 9:45 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 124 | 102400 | ||
| 301909078 | Taha_adeel | G | Jan. 19, 2025, 6:29 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 124 | 409600 | ||
| 301909451 | aryak05 | G | Jan. 19, 2025, 6:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 139 | 307200 | ||
| 301939591 | naromil | G | Jan. 20, 2025, 2:56 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 139 | 4915200 | ||
| 301937065 | virtual_self. | G | Jan. 20, 2025, 2:23 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 140 | 0 | ||
| 301929822 | joaopto | G | Jan. 20, 2025, 12:24 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 140 | 1126400 | ||
| 301918163 | Bleuewoosh | G | Jan. 19, 2025, 8:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 140 | 2764800 | ||
| 301938097 | XUAN_ | G | Jan. 20, 2025, 2:37 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 2457600 | ||
| 301909297 | kian2009 | G | Jan. 19, 2025, 6:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 155 | 2457600 | ||
| 301929264 | joaopto | G | Jan. 20, 2025, 12:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 156 | 1126400 | ||
| 301935863 | www_bilibili_com | G | Jan. 20, 2025, 2:06 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 77 | 1740800 | ||
| 301908496 | Taha_adeel | G | Jan. 19, 2025, 6:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 108 | 409600 | ||
| 301925936 | Sofapuden | G | Jan. 19, 2025, 10:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 109 | 0 | ||
| 301950137 | shengdanbucuo | G | Jan. 20, 2025, 5:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 109 | 102400 | ||
| 301941821 | yxfql | G | Jan. 20, 2025, 3:23 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 109 | 102400 | ||
| 301932003 | arodnap33 | G | Jan. 20, 2025, 1:06 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 109 | 102400 | ||
| 301926064 | Sofapuden | G | Jan. 19, 2025, 10:35 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 109 | 102400 | ||
| 301951704 | RUOHUI | G | Jan. 20, 2025, 5:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 102400 | ||
| 301943284 | Aimbyek | G | Jan. 20, 2025, 3:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 102400 | ||
| 301921244 | coder3000 | G | Jan. 19, 2025, 8:50 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 124 | 102400 | ||
| 301937985 | lrvideckis | G | Jan. 20, 2025, 2:36 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 109 | 102400 | ||
| 301909023 | Taha_adeel | G | Jan. 19, 2025, 6:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 109 | 512000 | ||
| 301914986 | YuukiS | G | Jan. 19, 2025, 7:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 109 | 3993600 | ||
| 301908363 | hhhhyf | G | Jan. 19, 2025, 6:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 0 | ||
| 301925343 | tkacper | G | Jan. 19, 2025, 10:18 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 102400 | ||
| 301924246 | BenjaminJ | G | Jan. 19, 2025, 9:51 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 102400 | ||
| 301911036 | yvbf | G | Jan. 19, 2025, 6:48 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 102400 | ||
| 301908992 | KobicGend | G | Jan. 19, 2025, 6:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 102400 | ||
| 301899608 | zjhl2 | G | Jan. 19, 2025, 5:25 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 102400 | ||
| 301903423 | Dorothy__ | G | Jan. 19, 2025, 5:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 20 | 124 | 1228800 | ||
| 301916239 | ykaan | G | Jan. 19, 2025, 7:49 p.m. | OK | Java 21 | TESTS | 20 | 937 | 6963200 | ||
| 301899804 | Z_actuary | G | Jan. 19, 2025, 5:26 p.m. | OK | PyPy 3-64 | TESTS | 20 | 343 | 44339200 | ||
| 301902577 | mutualns | G | Jan. 19, 2025, 5:39 p.m. | OK | PyPy 3-64 | TESTS | 20 | 546 | 71782400 | ||
| 301946817 | jvatsal0709 | G | Jan. 20, 2025, 4:27 a.m. | OK | PyPy 3-64 | TESTS | 20 | 827 | 45363200 | ||
| 301896700 | Proelectro444 | G | Jan. 19, 2025, 5:10 p.m. | OK | PyPy 3-64 | TESTS | 20 | 874 | 45363200 | ||
| 301953799 | Naruto_x | G | Jan. 20, 2025, 5:54 a.m. | OK | PyPy 3-64 | TESTS | 20 | 1030 | 65433600 | ||
| 301940317 | Listar | G | Jan. 20, 2025, 3:05 a.m. | OK | Python 3 | TESTS | 20 | 577 | 67993600 | ||
| 301906226 | sshs24083 | G | Jan. 19, 2025, 6:06 p.m. | OK | Python 3 | TESTS | 20 | 749 | 68198400 | ||
| 301893830 | Cafune | G | Jan. 19, 2025, 5:03 p.m. | OK | Python 3 | TESTS | 20 | 2734 | 173260800 | ||
| 301925355 | kalinov | G | Jan. 19, 2025, 10:18 p.m. | OK | Rust 2021 | TESTS | 20 | 93 | 1228800 | ||
| 301922980 | vstiff | G | Jan. 19, 2025, 9:23 p.m. | OK | Rust 2021 | TESTS | 20 | 109 | 15769600 | ||
| 301923117 | vstiff | G | Jan. 19, 2025, 9:26 p.m. | OK | Rust 2021 | TESTS | 20 | 124 | 15769600 | ||
| 301894548 | darkkcyan | G | Jan. 19, 2025, 5:04 p.m. | OK | Rust 2021 | TESTS | 20 | 140 | 20377600 |
Back to search problems