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 |
---|---|---|---|---|---|---|
1525 | Educational Codeforces Round 109 (Rated for Div. 2) | FINISHED | False | 7200 | 110671199 | May 16, 2021, 8 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 24983 ) | B | Permutation Sort | PROGRAMMING | constructive algorithms greedy |
B"You are given a permutation a consisting of n numbers 1 , 2 , ..., n (a permutation is an array in which each element from 1 to n occurs exactly once). You can perform the following operation: choose some subarray (contiguous subsegment) of a and rearrange the elements in it in any way you want. But this operation cannot be applied to the whole array. For example, if a = [2, 1, 4, 5, 3] and we want to apply the operation to the subarray a[2, 4] (the subarray containing all elements from the 2 -nd to the 4 -th), then after the operation, the array can become a = [2, 5, 1, 4, 3] or, for example, a = [2, 1, 5, 4, 3] . Your task is to calculate the minimum number of operations described above to sort the permutation a in ascending order. The first line contains a single integer t ( 1 <= t <= 2000 ) -- the number of test cases. The first line of the test case contains a single integer n ( 3 <= n <= 50 ) -- the number of elements in the permutation. The second line of the test case contains n distinct integers from 1 to n -- the given permutation a . For each test case, output a single integer -- the minimum number of operations described above to sort the array a in ascending order. In the explanations, a[i, j] defines the subarray of a that starts from the i -th element and ends with the j -th element. In the first test case of the example, you can select the subarray a[2, 3] and swap the elements in it. In the second test case of the example, the permutation is already sorted, so you don't need to apply any operations. In the third test case of the example, you can select the subarray a[3, 5] and reorder the elements in it so a becomes [2, 1, 3, 4, 5] , and then select the subarray a[1, 2] and swap the elements in it, so a becomes [1, 2, 3, 4, 5] . "... |
90793 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
116428046 | dinkan | B | May 16, 2021, 6:10 p.m. | OK | Clang++17 Diagnostics | TESTS | 4 | 358 | 5222400 | ||
116412397 | eugalt | B | May 16, 2021, 2:36 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 0 | ||
116427035 | it_vineh_ | B | May 16, 2021, 5:53 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 0 | ||
116402449 | Iizshit | B | May 16, 2021, 12:36 p.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116423760 | Aditya_871 | B | May 16, 2021, 5:02 p.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116393374 | Jexy | B | May 16, 2021, 11:01 a.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116433392 | _jazz | B | May 16, 2021, 7:57 p.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116444837 | noobdecoder | B | May 17, 2021, 3:35 a.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116427855 | Abhay_Rai | B | May 16, 2021, 6:08 p.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116391727 | akash0312 | B | May 16, 2021, 10:43 a.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116401990 | luoye | B | May 16, 2021, 12:31 p.m. | OK | GNU C11 | TESTS | 4 | 31 | 0 | ||
116390523 | marktoug | B | May 16, 2021, 10:31 a.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116450691 | ALLnxiglan | B | May 17, 2021, 5:35 a.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116447521 | BoringHacker | B | May 17, 2021, 4:38 a.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116447070 | fishcathu. | B | May 17, 2021, 4:29 a.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116443098 | Link_Space | B | May 17, 2021, 2:46 a.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116437530 | Werner_Yin | B | May 16, 2021, 10:22 p.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116417461 | wenzhuan | B | May 16, 2021, 3:34 p.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116411617 | 134567890 | B | May 16, 2021, 2:26 p.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116399659 | wangchenyu | B | May 16, 2021, 12:05 p.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116396373 | Dreamfarer | B | May 16, 2021, 11:29 a.m. | OK | GNU C++11 | TESTS | 4 | 15 | 0 | ||
116416424 | yayman | B | May 16, 2021, 3:23 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116417790 | dishainwati | B | May 16, 2021, 3:38 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116414442 | yyspencer | B | May 16, 2021, 2:59 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116418307 | Rohitmakkar | B | May 16, 2021, 3:45 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116420829 | himanshu_goldy | B | May 16, 2021, 4:18 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116414747 | ap71787 | B | May 16, 2021, 3:02 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116433264 | Night_Fury007 | B | May 16, 2021, 7:54 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116438890 | Dynamic_Squid | B | May 16, 2021, 11:36 p.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116447506 | arsalan9911 | B | May 17, 2021, 4:37 a.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116451109 | mr_chocha | B | May 17, 2021, 5:43 a.m. | OK | GNU C++14 | TESTS | 4 | 15 | 0 | ||
116443769 | QZSRY | B | May 17, 2021, 3:08 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116440305 | StevenXu | B | May 17, 2021, 12:52 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116439765 | Jr1Preg | B | May 17, 2021, 12:25 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116435024 | ee180002046 | B | May 16, 2021, 8:42 p.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116451088 | calyx | B | May 17, 2021, 5:43 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116449644 | heme007ndra | B | May 17, 2021, 5:18 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116448598 | suryam35 | B | May 17, 2021, 5 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116447934 | _pallab_99 | B | May 17, 2021, 4:47 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116446439 | Sauravkr | B | May 17, 2021, 4:13 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116441255 | tmstrixx | B | May 17, 2021, 1:35 a.m. | OK | GNU C++17 | TESTS | 4 | 15 | 0 | ||
116443868 | DocDoor | B | May 17, 2021, 3:10 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116451621 | RP_21 | B | May 17, 2021, 5:52 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116448366 | aeiou1 | B | May 17, 2021, 4:56 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116448285 | alif_cse_ju | B | May 17, 2021, 4:54 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116442158 | smax | B | May 17, 2021, 2:13 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116441993 | DargonFire | B | May 17, 2021, 2:05 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116440664 | mxhi_m | B | May 17, 2021, 1:09 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116439430 | WizardAP | B | May 17, 2021, 12:08 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116436517 | try_target | B | May 16, 2021, 9:38 p.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116433685 | timoffey14 | B | May 16, 2021, 8:05 p.m. | OK | GNU C++17 (64) | TESTS | 4 | 15 | 0 | ||
116446219 | Leaf_Bebop | B | May 17, 2021, 4:08 a.m. | OK | Go | TESTS | 4 | 77 | 0 | ||
116390107 | Pursuit_of_Accepted | B | May 16, 2021, 10:27 a.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116431947 | tishrah_ | B | May 16, 2021, 7:22 p.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116409280 | ypa | B | May 16, 2021, 1:56 p.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116404054 | dauom | B | May 16, 2021, 12:54 p.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116388913 | future_me | B | May 16, 2021, 10:17 a.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116387906 | arpit31 | B | May 16, 2021, 10:10 a.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116387577 | kareem3id | B | May 16, 2021, 10:08 a.m. | OK | Java 11 | TESTS | 4 | 171 | 0 | ||
116439329 | DedsecKnight | B | May 17, 2021, 12:02 a.m. | OK | Java 11 | TESTS | 4 | 186 | 0 | ||
116406341 | algothink | B | May 16, 2021, 1:21 p.m. | OK | Java 11 | TESTS | 4 | 186 | 0 | ||
116392785 | devil_the_coder | B | May 16, 2021, 10:55 a.m. | OK | Java 11 | TESTS | 4 | 186 | 0 | ||
116441095 | TheSawan | B | May 17, 2021, 1:29 a.m. | OK | Java 8 | TESTS | 4 | 93 | 0 | ||
116434968 | twoBit | B | May 16, 2021, 8:41 p.m. | OK | Java 8 | TESTS | 4 | 93 | 0 | ||
116388036 | kzhang2012 | B | May 16, 2021, 10:11 a.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116387598 | PRIYANSH_TOMAR | B | May 16, 2021, 10:08 a.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116450871 | avneet_081 | B | May 17, 2021, 5:39 a.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116444276 | aljipa | B | May 17, 2021, 3:20 a.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116435799 | Agnimandur | B | May 16, 2021, 9:09 p.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116420538 | Manan8686 | B | May 16, 2021, 4:14 p.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116407554 | YahiaSherif | B | May 16, 2021, 1:35 p.m. | OK | Java 8 | TESTS | 4 | 109 | 0 | ||
116428538 | itsAllPassion | B | May 16, 2021, 6:19 p.m. | OK | Java 8 | TESTS | 4 | 124 | 0 | ||
116398789 | codersanjeev | B | May 16, 2021, 11:55 a.m. | OK | Kotlin | TESTS | 4 | 171 | 102400 | ||
116387173 | muhammadmunna | B | May 16, 2021, 10:05 a.m. | OK | Kotlin | TESTS | 4 | 171 | 102400 | ||
116423361 | koper | B | May 16, 2021, 4:55 p.m. | OK | Kotlin | TESTS | 4 | 202 | 1843200 | ||
116430148 | wbars | B | May 16, 2021, 6:47 p.m. | OK | Kotlin | TESTS | 4 | 311 | 1945600 | ||
116413906 | TRR | B | May 16, 2021, 2:53 p.m. | OK | Mono C# | TESTS | 4 | 78 | 3072000 | ||
116384399 | jjune1416 | B | May 16, 2021, 9:56 a.m. | OK | MS C++ 2017 | TESTS | 4 | 46 | 0 | ||
116419802 | dingzhao777 | B | May 16, 2021, 4:04 p.m. | OK | MS C++ 2017 | TESTS | 4 | 46 | 409600 | ||
116446397 | cosinechicken | B | May 17, 2021, 4:12 a.m. | OK | MS C++ 2017 | TESTS | 4 | 46 | 409600 | ||
116423761 | mishra-aayush | B | May 16, 2021, 5:02 p.m. | OK | MS C++ 2017 | TESTS | 4 | 61 | 0 | ||
116396176 | yapril | B | May 16, 2021, 11:27 a.m. | OK | MS C++ 2017 | TESTS | 4 | 62 | 0 | ||
116443877 | Gosheri | B | May 17, 2021, 3:10 a.m. | OK | MS C++ 2017 | TESTS | 4 | 62 | 0 | ||
116427747 | camacju | B | May 16, 2021, 6:05 p.m. | OK | MS C++ 2017 | TESTS | 4 | 62 | 0 | ||
116388500 | Harshita_0304 | B | May 16, 2021, 10:14 a.m. | OK | MS C++ 2017 | TESTS | 4 | 62 | 0 | ||
116410583 | Septemberstar | B | May 16, 2021, 2:13 p.m. | OK | MS C++ 2017 | TESTS | 4 | 77 | 0 | ||
116393183 | rus_MiKir | B | May 16, 2021, 10:59 a.m. | OK | MS C++ 2017 | TESTS | 4 | 77 | 0 | ||
116440495 | sakapon | B | May 17, 2021, 1 a.m. | OK | .NET Core C# | TESTS | 4 | 77 | 3174400 | ||
116422985 | Lap_Tapk | B | May 16, 2021, 4:50 p.m. | OK | .NET Core C# | TESTS | 4 | 140 | 3072000 | ||
116394597 | lukas_rimkus | B | May 16, 2021, 11:12 a.m. | OK | Node.js | TESTS | 4 | 93 | 5017600 | ||
116389973 | henrychenOutlook | B | May 16, 2021, 10:26 a.m. | OK | Node.js | TESTS | 4 | 93 | 5120000 | ||
116436631 | ayman1503 | B | May 16, 2021, 9:42 p.m. | OK | PHP | TESTS | 4 | 31 | 0 | ||
116428452 | whaleee | B | May 16, 2021, 6:18 p.m. | OK | PyPy 2 | TESTS | 4 | 108 | 3072000 | ||
116423231 | AlexMayhem | B | May 16, 2021, 4:53 p.m. | OK | PyPy 3 | TESTS | 4 | 139 | 4812800 | ||
116423274 | jaglike_makkar | B | May 16, 2021, 4:54 p.m. | OK | PyPy 3 | TESTS | 4 | 140 | 3891200 | ||
116398214 | pakshi_141199 | B | May 16, 2021, 11:48 a.m. | OK | PyPy 3 | TESTS | 4 | 140 | 5427200 | ||
116447584 | skhan_org | B | May 17, 2021, 4:39 a.m. | OK | PyPy 3 | TESTS | 4 | 155 | 3891200 | ||
116438312 | Liberator187 | B | May 16, 2021, 11:06 p.m. | OK | PyPy 3 | TESTS | 4 | 155 | 4198400 | ||
116391324 | scuby30 | B | May 16, 2021, 10:38 a.m. | OK | PyPy 3 | TESTS | 4 | 155 | 5017600 | ||
116429588 | surojit008 | B | May 16, 2021, 6:38 p.m. | OK | PyPy 3 | TESTS | 4 | 155 | 5427200 | ||
116394182 | vvedant99 | B | May 16, 2021, 11:09 a.m. | OK | PyPy 3 | TESTS | 4 | 156 | 3788800 | ||
116431187 | _aadiupadhyay_ | B | May 16, 2021, 7:06 p.m. | OK | PyPy 3 | TESTS | 4 | 156 | 4300800 | ||
116420940 | abhishek4981 | B | May 16, 2021, 4:20 p.m. | OK | PyPy 3 | TESTS | 4 | 156 | 5632000 | ||
116411422 | Lakshit040 | B | May 16, 2021, 2:23 p.m. | OK | Python 3 | TESTS | 4 | 61 | 614400 | ||
116441606 | BugLeave | B | May 17, 2021, 1:50 a.m. | OK | Python 3 | TESTS | 4 | 77 | 0 | ||
116435126 | ghoshsanchita656 | B | May 16, 2021, 8:46 p.m. | OK | Python 3 | TESTS | 4 | 77 | 0 | ||
116430150 | bhawna_27 | B | May 16, 2021, 6:47 p.m. | OK | Python 3 | TESTS | 4 | 77 | 0 | ||
116430102 | Shub_17 | B | May 16, 2021, 6:46 p.m. | OK | Python 3 | TESTS | 4 | 77 | 0 | ||
116415942 | Kaatil | B | May 16, 2021, 3:16 p.m. | OK | Python 3 | TESTS | 4 | 77 | 0 | ||
116393377 | eugalt | B | May 16, 2021, 11:01 a.m. | OK | Python 3 | TESTS | 4 | 77 | 307200 | ||
116389950 | sudhirMTS | B | May 16, 2021, 10:26 a.m. | OK | Python 3 | TESTS | 4 | 77 | 716800 | ||
116443723 | kunalverma19 | B | May 17, 2021, 3:06 a.m. | OK | Python 3 | TESTS | 4 | 78 | 0 | ||
116450916 | swati2411 | B | May 17, 2021, 5:40 a.m. | OK | Python 3 | TESTS | 4 | 78 | 0 | ||
116450928 | zheland | B | May 17, 2021, 5:40 a.m. | OK | Rust | TESTS | 4 | 15 | 0 |
Back to search problems