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 |
---|---|---|---|---|---|---|
1768 | Codeforces Round 842 (Div. 2) | FINISHED | False | 7200 | 58893899 | Jan. 5, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 23254 ) | B | Quick Sort | PROGRAMMING | greedy math |
B'You are given a permutation ^ dagger p of length n and a positive integer k <= n . In one operation, you: For example, if p = [2,5,1,3,4] and k = 2 and you choose 5 and 3 as the elements for the operation, then [2, color{red}{5}, 1, color{red}{3}, 4] rightarrow [2, 1, 4, color{red}{3}, color{red}{5}] . Find the minimum number of operations needed to sort the permutation in increasing order. It can be proven that it is always possible to do so. ^ dagger 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). The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains two integers n and k ( 2 <= n <= 10^5 , 1 <= k <= n ). The second line of each test case contains n integers p_1,p_2, ldots, p_n ( 1 <= p_i <= n ). It is guaranteed that p is a permutation. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case output a single integer -- the minimum number of operations needed to sort the permutation. It can be proven that it is always possible to do so. In the first test case, the permutation is already sorted. In the second test case, you can choose element 3 , and the permutation will become sorted as follows: [ color{red}{3}, 1, 2] rightarrow [1, 2, color{red}{3}] . In the third test case, you can choose elements 3 and 4 , and the permutation will become sorted as follows: [1, color{red}{3}, 2, color{red}{4}] rightarrow [1, 2, color{red}{3}, color{red}{4}]$'... |
Codeforces Round #842 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
188152628 | Wizard_of_Orz | B | Jan. 6, 2023, 12:48 a.m. | OK | Clang++17 Diagnostics | TESTS | 14 | 46 | 0 | ||
188140631 | NenadDapic | B | Jan. 5, 2023, 7:38 p.m. | OK | FPC | TESTS | 14 | 46 | 819200 | ||
188170220 | SP2003 | B | Jan. 6, 2023, 6 a.m. | OK | GNU C11 | TESTS | 14 | 61 | 0 | ||
188117573 | Ansh_Shah_ | B | Jan. 5, 2023, 4:26 p.m. | OK | GNU C11 | TESTS | 14 | 61 | 409600 | ||
188119258 | umang_patel339 | B | Jan. 5, 2023, 4:30 p.m. | OK | GNU C11 | TESTS | 14 | 61 | 409600 | ||
188116856 | prabhat_suresh | B | Jan. 5, 2023, 4:24 p.m. | OK | GNU C11 | TESTS | 14 | 62 | 0 | ||
188126107 | iffatul_anon | B | Jan. 5, 2023, 5:32 p.m. | OK | GNU C11 | TESTS | 14 | 62 | 409600 | ||
188119267 | Neel_174 | B | Jan. 5, 2023, 4:30 p.m. | OK | GNU C11 | TESTS | 14 | 62 | 409600 | ||
188160143 | hnust_suzhiqin | B | Jan. 6, 2023, 3:40 a.m. | OK | GNU C11 | TESTS | 14 | 62 | 819200 | ||
188155889 | nst_19 | B | Jan. 6, 2023, 2:19 a.m. | OK | GNU C11 | TESTS | 14 | 62 | 819200 | ||
188139247 | Arif_LU84 | B | Jan. 5, 2023, 7:19 p.m. | OK | GNU C11 | TESTS | 14 | 78 | 819200 | ||
188140222 | StupidGuy13 | B | Jan. 5, 2023, 7:32 p.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188163612 | jifbt | B | Jan. 6, 2023, 4:39 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188150149 | ysys | B | Jan. 5, 2023, 11:17 p.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188152586 | _fengxiaoyi | B | Jan. 6, 2023, 12:47 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188156997 | justD1o | B | Jan. 6, 2023, 2:42 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188153111 | Shukuang | B | Jan. 6, 2023, 1:05 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188144928 | adhm157 | B | Jan. 5, 2023, 8:49 p.m. | OK | GNU C++14 | TESTS | 14 | 31 | 0 | ||
188164927 | calciiium | B | Jan. 6, 2023, 4:57 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 409600 | ||
188164542 | DanRan02 | B | Jan. 6, 2023, 4:52 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 409600 | ||
188169791 | YSY20091 | B | Jan. 6, 2023, 5:55 a.m. | OK | GNU C++14 | TESTS | 14 | 31 | 409600 | ||
188145711 | Roman70 | B | Jan. 5, 2023, 9:05 p.m. | OK | GNU C++17 | TESTS | 14 | 15 | 819200 | ||
188140157 | INS_Vikrant | B | Jan. 5, 2023, 7:31 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188137904 | MBENNI | B | Jan. 5, 2023, 7:01 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188137389 | Vxrtesh | B | Jan. 5, 2023, 6:55 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188128663 | CEH_Abanoub_Ashraf_1 | B | Jan. 5, 2023, 5:45 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188166304 | abmorpheus | B | Jan. 6, 2023, 5:15 a.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188163419 | evor35 | B | Jan. 6, 2023, 4:36 a.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188150236 | rodrodrod | B | Jan. 5, 2023, 11:20 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188144070 | algohary | B | Jan. 5, 2023, 8:33 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188140530 | DhoNi_hObar_Mojar_khelA | B | Jan. 5, 2023, 7:36 p.m. | OK | GNU C++17 | TESTS | 14 | 31 | 0 | ||
188152174 | David2019 | B | Jan. 6, 2023, 12:34 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 30 | 409600 | ||
188132701 | dufresne_1949 | B | Jan. 5, 2023, 6:11 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 30 | 819200 | ||
188158735 | 0822 | B | Jan. 6, 2023, 3:15 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 30 | 7987200 | ||
188143211 | Rayhan1011414120 | B | Jan. 5, 2023, 8:18 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 0 | ||
188130660 | CurryWOE | B | Jan. 5, 2023, 5:57 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 0 | ||
188160860 | xiaoyiru | B | Jan. 6, 2023, 3:53 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 0 | ||
188163240 | svs_25 | B | Jan. 6, 2023, 4:33 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 409600 | ||
188166193 | JYJin | B | Jan. 6, 2023, 5:13 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 409600 | ||
188159951 | Sahil_hussain | B | Jan. 6, 2023, 3:37 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 409600 | ||
188156501 | PandemicP | B | Jan. 6, 2023, 2:32 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 31 | 409600 | ||
188127674 | Hinata07 | B | Jan. 5, 2023, 5:39 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
188142398 | abuziedbasmala | B | Jan. 5, 2023, 8:04 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
188151083 | JustACommonMan | B | Jan. 5, 2023, 11:54 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
188155639 | GuCen | B | Jan. 6, 2023, 2:14 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
188149744 | irkstepanov | B | Jan. 5, 2023, 11:02 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 409600 | ||
188164239 | AndreyPavlov | B | Jan. 6, 2023, 4:48 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 409600 | ||
188126720 | baby._.shadow | B | Jan. 5, 2023, 5:35 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 409600 | ||
188138394 | Qatary | B | Jan. 5, 2023, 7:08 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 409600 | ||
188139751 | mraron | B | Jan. 5, 2023, 7:25 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 409600 | ||
188146856 | maximumSHOT | B | Jan. 5, 2023, 9:32 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 409600 | ||
188150580 | katomasao | B | Jan. 5, 2023, 11:33 p.m. | OK | Haskell | TESTS | 14 | 296 | 0 | ||
188164813 | paras3019 | B | Jan. 6, 2023, 4:55 a.m. | OK | Java 11 | TESTS | 14 | 186 | 2764800 | ||
188164395 | crazycoder143 | B | Jan. 6, 2023, 4:50 a.m. | OK | Java 11 | TESTS | 14 | 187 | 0 | ||
188137915 | demonkillerh | B | Jan. 5, 2023, 7:01 p.m. | OK | Java 11 | TESTS | 14 | 187 | 0 | ||
188126564 | kartik__sethi | B | Jan. 5, 2023, 5:34 p.m. | OK | Java 11 | TESTS | 14 | 187 | 0 | ||
188131026 | YellowBlueRed | B | Jan. 5, 2023, 6 p.m. | OK | Java 11 | TESTS | 14 | 218 | 0 | ||
188135634 | prachigupta | B | Jan. 5, 2023, 6:35 p.m. | OK | Java 11 | TESTS | 14 | 234 | 0 | ||
188130586 | ritik0602 | B | Jan. 5, 2023, 5:57 p.m. | OK | Java 11 | TESTS | 14 | 248 | 2150400 | ||
188120154 | Hawater | B | Jan. 5, 2023, 4:32 p.m. | OK | Java 11 | TESTS | 14 | 249 | 0 | ||
188144326 | mustankap | B | Jan. 5, 2023, 8:38 p.m. | OK | Java 11 | TESTS | 14 | 249 | 0 | ||
188130839 | AadishJain | B | Jan. 5, 2023, 5:58 p.m. | OK | Java 11 | TESTS | 14 | 249 | 0 | ||
188137513 | this.is.shivamsingh | B | Jan. 5, 2023, 6:57 p.m. | OK | Java 17 | TESTS | 14 | 202 | 409600 | ||
188116187 | RammohanSharma | B | Jan. 5, 2023, 4:23 p.m. | OK | Java 17 | TESTS | 14 | 218 | 512000 | ||
188149017 | StacGnihsihp | B | Jan. 5, 2023, 10:37 p.m. | OK | Java 17 | TESTS | 14 | 233 | 716800 | ||
188156006 | Jatinydv17 | B | Jan. 6, 2023, 2:21 a.m. | OK | Java 17 | TESTS | 14 | 234 | 204800 | ||
188165899 | Thejas_n | B | Jan. 6, 2023, 5:09 a.m. | OK | Java 17 | TESTS | 14 | 249 | 512000 | ||
188135928 | merlin_ | B | Jan. 5, 2023, 6:39 p.m. | OK | Java 17 | TESTS | 14 | 249 | 3481600 | ||
188127602 | not_just_rr | B | Jan. 5, 2023, 5:39 p.m. | OK | Java 17 | TESTS | 14 | 264 | 204800 | ||
188126747 | MishkaGrig | B | Jan. 5, 2023, 5:35 p.m. | OK | Java 17 | TESTS | 14 | 264 | 307200 | ||
188132142 | ayushdragneel27 | B | Jan. 5, 2023, 6:06 p.m. | OK | Java 17 | TESTS | 14 | 264 | 409600 | ||
188165108 | jameszhangrg | B | Jan. 6, 2023, 4:59 a.m. | OK | Java 17 | TESTS | 14 | 280 | 2560000 | ||
188165568 | lpychemistry | B | Jan. 6, 2023, 5:05 a.m. | OK | Java 8 | TESTS | 14 | 109 | 0 | ||
188163926 | Pranay_ | B | Jan. 6, 2023, 4:44 a.m. | OK | Java 8 | TESTS | 14 | 109 | 0 | ||
188139484 | HideBeyondYou | B | Jan. 5, 2023, 7:22 p.m. | OK | Java 8 | TESTS | 14 | 109 | 0 | ||
188131259 | Ahmad_Hoseiny | B | Jan. 5, 2023, 6:02 p.m. | OK | Java 8 | TESTS | 14 | 155 | 0 | ||
188129430 | rohit_ramdas_v | B | Jan. 5, 2023, 5:49 p.m. | OK | Java 8 | TESTS | 14 | 156 | 3072000 | ||
188128211 | Koka | B | Jan. 5, 2023, 5:42 p.m. | OK | Java 8 | TESTS | 14 | 171 | 6144000 | ||
188139810 | imvivekthakur | B | Jan. 5, 2023, 7:26 p.m. | OK | Java 8 | TESTS | 14 | 187 | 0 | ||
188157263 | ArcadioN | B | Jan. 6, 2023, 2:47 a.m. | OK | Java 8 | TESTS | 14 | 202 | 0 | ||
188133331 | abhayrajnegi0416 | B | Jan. 5, 2023, 6:16 p.m. | OK | Java 8 | TESTS | 14 | 202 | 6041600 | ||
188126741 | toufique_husein | B | Jan. 5, 2023, 5:35 p.m. | OK | Java 8 | TESTS | 14 | 249 | 0 | ||
188120863 | QianShao | B | Jan. 5, 2023, 4:33 p.m. | OK | MS C++ 2017 | TESTS | 14 | 31 | 0 | ||
188131995 | alaevS | B | Jan. 5, 2023, 6:05 p.m. | OK | MS C++ 2017 | TESTS | 14 | 78 | 409600 | ||
188157757 | ishybee | B | Jan. 6, 2023, 2:56 a.m. | OK | MS C++ 2017 | TESTS | 14 | 108 | 0 | ||
188169989 | pursuita | B | Jan. 6, 2023, 5:57 a.m. | OK | MS C++ 2017 | TESTS | 14 | 109 | 409600 | ||
188164192 | Cubgl | B | Jan. 6, 2023, 4:47 a.m. | OK | MS C++ 2017 | TESTS | 14 | 109 | 819200 | ||
188158738 | cz1137 | B | Jan. 6, 2023, 3:15 a.m. | OK | MS C++ 2017 | TESTS | 14 | 109 | 819200 | ||
188119120 | console.shivam | B | Jan. 5, 2023, 4:29 p.m. | OK | MS C++ 2017 | TESTS | 14 | 124 | 819200 | ||
188142685 | jkutrzeba1 | B | Jan. 5, 2023, 8:09 p.m. | OK | MS C++ 2017 | TESTS | 14 | 124 | 3276800 | ||
188118719 | beksultanomirzak.2001 | B | Jan. 5, 2023, 4:28 p.m. | OK | Node.js | TESTS | 14 | 249 | 7168000 | ||
188129365 | rsFalse | B | Jan. 5, 2023, 5:49 p.m. | OK | Perl | TESTS | 14 | 249 | 13107200 | ||
188129299 | rsFalse | B | Jan. 5, 2023, 5:48 p.m. | OK | Perl | TESTS | 14 | 249 | 13824000 | ||
188129104 | yihuicui | B | Jan. 5, 2023, 5:47 p.m. | OK | PyPy 2 | TESTS | 14 | 139 | 7270400 | ||
188144167 | Khatarnak_Khandu | B | Jan. 5, 2023, 8:35 p.m. | OK | PyPy 3 | TESTS | 14 | 155 | 9420800 | ||
188132788 | Su_123 | B | Jan. 5, 2023, 6:11 p.m. | OK | PyPy 3 | TESTS | 14 | 202 | 10547200 | ||
188146947 | DedMartyn | B | Jan. 5, 2023, 9:34 p.m. | OK | PyPy 3 | TESTS | 14 | 326 | 10752000 | ||
188130981 | torqueaj | B | Jan. 5, 2023, 6 p.m. | OK | PyPy 3 | TESTS | 14 | 343 | 10547200 | ||
188118477 | darluk6 | B | Jan. 5, 2023, 4:28 p.m. | OK | PyPy 3 | TESTS | 14 | 374 | 11161600 | ||
188159136 | mathsworm | B | Jan. 6, 2023, 3:22 a.m. | OK | PyPy 3 | TESTS | 14 | 421 | 12185600 | ||
188151548 | Betanine | B | Jan. 6, 2023, 12:11 a.m. | OK | PyPy 3-64 | TESTS | 14 | 77 | 13107200 | ||
188126084 | Nabeel_Ismaeel | B | Jan. 5, 2023, 5:32 p.m. | OK | PyPy 3-64 | TESTS | 14 | 93 | 14131200 | ||
188115614 | abxxx | B | Jan. 5, 2023, 4:21 p.m. | OK | PyPy 3-64 | TESTS | 14 | 93 | 14131200 | ||
188140316 | nealzane | B | Jan. 5, 2023, 7:33 p.m. | OK | PyPy 3-64 | TESTS | 14 | 108 | 11776000 | ||
188153365 | RobinFromTheHood | B | Jan. 6, 2023, 1:13 a.m. | OK | PyPy 3-64 | TESTS | 14 | 108 | 13004800 | ||
188168804 | Youarenotgood | B | Jan. 6, 2023, 5:44 a.m. | OK | PyPy 3-64 | TESTS | 14 | 108 | 13312000 | ||
188158824 | DP_FORMULA | B | Jan. 6, 2023, 3:16 a.m. | OK | PyPy 3-64 | TESTS | 14 | 108 | 13312000 | ||
188136375 | gardengnome | B | Jan. 5, 2023, 6:43 p.m. | OK | PyPy 3-64 | TESTS | 14 | 108 | 13824000 | ||
188155948 | Varad | B | Jan. 6, 2023, 2:20 a.m. | OK | PyPy 3-64 | TESTS | 14 | 109 | 12902400 | ||
188135566 | FrozenKandy | B | Jan. 5, 2023, 6:35 p.m. | OK | PyPy 3-64 | TESTS | 14 | 109 | 13721600 | ||
188166819 | yaojia123 | B | Jan. 6, 2023, 5:21 a.m. | OK | Python 3 | TESTS | 14 | 155 | 6963200 | ||
188164600 | gokulraaj59 | B | Jan. 6, 2023, 4:52 a.m. | OK | Python 3 | TESTS | 14 | 155 | 6963200 | ||
188163199 | Aryan28 | B | Jan. 6, 2023, 4:32 a.m. | OK | Python 3 | TESTS | 14 | 155 | 6963200 | ||
188142555 | Rayhan1011414120 | B | Jan. 5, 2023, 8:07 p.m. | OK | Python 3 | TESTS | 14 | 155 | 6963200 | ||
188135092 | Kimic | B | Jan. 5, 2023, 6:31 p.m. | OK | Python 3 | TESTS | 14 | 155 | 6963200 | ||
188129400 | satyajeetdas045 | B | Jan. 5, 2023, 5:49 p.m. | OK | Python 3 | TESTS | 14 | 155 | 6963200 | ||
188120722 | abhay-raj19 | B | Jan. 5, 2023, 4:33 p.m. | OK | Python 3 | TESTS | 14 | 156 | 6963200 | ||
188115088 | Viv_singh | B | Jan. 5, 2023, 4:20 p.m. | OK | Python 3 | TESTS | 14 | 156 | 6963200 | ||
188130279 | iznurlan | B | Jan. 5, 2023, 5:54 p.m. | OK | Python 3 | TESTS | 14 | 170 | 6963200 | ||
188118562 | -10- | B | Jan. 5, 2023, 4:28 p.m. | OK | Python 3 | TESTS | 14 | 170 | 6963200 | ||
188151759 | Spheniscine | B | Jan. 6, 2023, 12:18 a.m. | OK | Rust 2021 | TESTS | 14 | 31 | 921600 | ||
188140866 | variance | B | Jan. 5, 2023, 7:41 p.m. | OK | Rust 2021 | TESTS | 14 | 92 | 2048000 |
Back to search problems