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 |
---|---|---|---|---|---|---|
1778 | Codeforces Round 848 (Div. 2) | FINISHED | False | 7200 | 56561099 | Feb. 1, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 13385 ) | B | The Forbidden Permutation | PROGRAMMING | greedy math |
B"You are given a permutation p of length n , an array of m distinct integers a_1, a_2, ldots, a_m ( 1 <= a_i <= n ), and an integer d . Let mathrm{pos}(x) be the index of x in the permutation p . The array a is not good if For example, with the permutation p = [4, 2, 1, 3, 6, 5] and d = 2 : In one move, you can swap two adjacent elements of the permutation p . What is the minimum number of moves needed such that the array a becomes good? It can be shown that there always exists a sequence of moves so that the array a becomes good. A permutation 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 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains three integers n , m and d ( 2 <= q n <= q 10^5 , 2 <= q m <= q n , 1 <= d <= n ), the length of the permutation p , the length of the array a and the value of d . The second line contains n integers p_1, p_2, ldots, p_n ( 1 <= q p_i <= q n , p_i ne p_j for i ne j ). The third line contains m distinct integers a_1, a_2, ldots, a_m ( 1 <= q a_i <= q n , a_i ne a_j for i ne j ). The sum of n over all test cases doesn't exceed 5 cdot 10^5 . For each test case, print the minimum number of moves needed such that the array a becomes good. In the first case, pos(a_1)=1 , pos(a_2)=3 . To make the array good, one way is to swap p_3 and p_4 . After that, the array a will be good b"... |
Codeforces Round #848 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
191635434 | AIM1rage | B | Feb. 1, 2023, 10:32 p.m. | OK | C# 10 | TESTS | 15 | 171 | 55500800 | ||
191597507 | kirsider | B | Feb. 1, 2023, 4:17 p.m. | OK | C# 10 | TESTS | 15 | 514 | 33280000 | ||
191619190 | SP2003 | B | Feb. 1, 2023, 6:43 p.m. | OK | GNU C11 | TESTS | 15 | 140 | 409600 | ||
191647218 | Smallorange | B | Feb. 2, 2023, 2:39 a.m. | OK | GNU C11 | TESTS | 15 | 140 | 819200 | ||
191611155 | Umnikfan | B | Feb. 1, 2023, 5:43 p.m. | OK | GNU C11 | TESTS | 15 | 140 | 1228800 | ||
191599315 | sanjay77 | B | Feb. 1, 2023, 4:23 p.m. | OK | GNU C11 | TESTS | 15 | 156 | 1228800 | ||
191599420 | i_am_rusher | B | Feb. 1, 2023, 4:23 p.m. | OK | GNU C11 | TESTS | 15 | 452 | 1228800 | ||
191595313 | yu_lingyu | B | Feb. 1, 2023, 4:09 p.m. | OK | GNU C++14 | TESTS | 15 | 124 | 1228800 | ||
191620422 | yau | B | Feb. 1, 2023, 6:55 p.m. | OK | GNU C++14 | TESTS | 15 | 124 | 1228800 | ||
191595758 | c_sum_sym_xy | B | Feb. 1, 2023, 4:11 p.m. | OK | GNU C++14 | TESTS | 15 | 124 | 3993600 | ||
191612302 | 202103023413 | B | Feb. 1, 2023, 5:50 p.m. | OK | GNU C++14 | TESTS | 15 | 140 | 2457600 | ||
191630389 | Mhamad_aboaljood | B | Feb. 1, 2023, 9:01 p.m. | OK | GNU C++14 | TESTS | 15 | 140 | 2969600 | ||
191611621 | Bhaumil_Patel_18 | B | Feb. 1, 2023, 5:45 p.m. | OK | GNU C++14 | TESTS | 15 | 155 | 3584000 | ||
191643352 | sacave | B | Feb. 2, 2023, 1:36 a.m. | OK | GNU C++14 | TESTS | 15 | 156 | 3993600 | ||
191655216 | dblck | B | Feb. 2, 2023, 4:20 a.m. | OK | GNU C++14 | TESTS | 15 | 156 | 6553600 | ||
191652814 | WyyOIer | B | Feb. 2, 2023, 4:05 a.m. | OK | GNU C++14 | TESTS | 15 | 170 | 1228800 | ||
191640789 | FreshOrange | B | Feb. 2, 2023, 12:44 a.m. | OK | GNU C++14 | TESTS | 15 | 170 | 1331200 | ||
191611357 | wackyIndian | B | Feb. 1, 2023, 5:44 p.m. | OK | GNU C++17 | TESTS | 15 | 124 | 1228800 | ||
191618753 | cadence123 | B | Feb. 1, 2023, 6:39 p.m. | OK | GNU C++17 | TESTS | 15 | 155 | 2252800 | ||
191595676 | zgw | B | Feb. 1, 2023, 4:11 p.m. | OK | GNU C++17 | TESTS | 15 | 155 | 2355200 | ||
191610916 | MSD_07 | B | Feb. 1, 2023, 5:41 p.m. | OK | GNU C++17 | TESTS | 15 | 155 | 4198400 | ||
191599163 | vishu826 | B | Feb. 1, 2023, 4:22 p.m. | OK | GNU C++17 | TESTS | 15 | 155 | 8192000 | ||
191597567 | payalmittal | B | Feb. 1, 2023, 4:17 p.m. | OK | GNU C++17 | TESTS | 15 | 156 | 1843200 | ||
191593778 | mk29 | B | Feb. 1, 2023, 4:05 p.m. | OK | GNU C++17 | TESTS | 15 | 156 | 2969600 | ||
191643912 | HEIMAOJINGZHANG | B | Feb. 2, 2023, 1:45 a.m. | OK | GNU C++17 | TESTS | 15 | 156 | 12083200 | ||
191608240 | themm1 | B | Feb. 1, 2023, 5:27 p.m. | OK | GNU C++17 | TESTS | 15 | 170 | 1843200 | ||
191632413 | viraj_jagtap | B | Feb. 1, 2023, 9:33 p.m. | OK | GNU C++17 | TESTS | 15 | 170 | 2764800 | ||
191597423 | border | B | Feb. 1, 2023, 4:17 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 93 | 4812800 | ||
191595970 | M7kra | B | Feb. 1, 2023, 4:12 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 409600 | ||
191616524 | Mostafa_Moharram | B | Feb. 1, 2023, 6:20 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 819200 | ||
191618251 | Hashira | B | Feb. 1, 2023, 6:35 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 1126400 | ||
191598312 | Andreasyan | B | Feb. 1, 2023, 4:20 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 1228800 | ||
191658806 | Lin_ | B | Feb. 2, 2023, 5:12 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 1638400 | ||
191602506 | omar_mahmoud1 | B | Feb. 1, 2023, 4:32 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 2355200 | ||
191655556 | vjudge5 | B | Feb. 2, 2023, 4:26 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 108 | 3174400 | ||
191631865 | Vedant_05 | B | Feb. 1, 2023, 9:24 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 109 | 716800 | ||
191657316 | Aron_A_D_S | B | Feb. 2, 2023, 4:51 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 109 | 819200 | ||
191597340 | BnKhalid | B | Feb. 1, 2023, 4:16 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1126400 | ||
191619104 | BnKhalid | B | Feb. 1, 2023, 6:42 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1126400 | ||
191620701 | abuhamdeh61 | B | Feb. 1, 2023, 6:58 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1126400 | ||
191623282 | nirmalg | B | Feb. 1, 2023, 7:27 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1126400 | ||
191653387 | VijaySue | B | Feb. 2, 2023, 4:14 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1536000 | ||
191628043 | Ivan_len | B | Feb. 1, 2023, 8:27 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1536000 | ||
191638053 | _SADIEM_ | B | Feb. 1, 2023, 11:34 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1536000 | ||
191608288 | Serendipity__ | B | Feb. 1, 2023, 5:27 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 1945600 | ||
191614164 | rajipthakur01 | B | Feb. 1, 2023, 6:02 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 2457600 | ||
191642778 | baonb789 | B | Feb. 2, 2023, 1:25 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 78 | 6451200 | ||
191595354 | pushkar.lonkar21 | B | Feb. 1, 2023, 4:10 p.m. | OK | Java 11 | TESTS | 15 | 202 | 0 | ||
191600548 | goudezhao | B | Feb. 1, 2023, 4:26 p.m. | OK | Java 11 | TESTS | 15 | 248 | 0 | ||
191615113 | sduMamytbekov | B | Feb. 1, 2023, 6:09 p.m. | OK | Java 11 | TESTS | 15 | 296 | 0 | ||
191594752 | Pranav_Sharda | B | Feb. 1, 2023, 4:08 p.m. | OK | Java 11 | TESTS | 15 | 311 | 0 | ||
191656795 | Jackyjuman | B | Feb. 2, 2023, 4:44 a.m. | OK | Java 11 | TESTS | 15 | 327 | 0 | ||
191592412 | ritvik369 | B | Feb. 1, 2023, 4:01 p.m. | OK | Java 11 | TESTS | 15 | 452 | 8499200 | ||
191642990 | wantu | B | Feb. 2, 2023, 1:28 a.m. | OK | Java 11 | TESTS | 15 | 498 | 4915200 | ||
191626142 | pakkapapad | B | Feb. 1, 2023, 8:02 p.m. | OK | Java 11 | TESTS | 15 | 530 | 10137600 | ||
191617424 | samitdas03 | B | Feb. 1, 2023, 6:28 p.m. | OK | Java 11 | TESTS | 15 | 545 | 9932800 | ||
191662186 | iknownothing13 | B | Feb. 2, 2023, 5:56 a.m. | OK | Java 11 | TESTS | 15 | 546 | 9625600 | ||
191627975 | Mamimi | B | Feb. 1, 2023, 8:26 p.m. | OK | Java 17 | TESTS | 15 | 296 | 921600 | ||
191594492 | Eslam_Ahmed | B | Feb. 1, 2023, 4:07 p.m. | OK | Java 17 | TESTS | 15 | 311 | 1228800 | ||
191619909 | altik_nik | B | Feb. 1, 2023, 6:50 p.m. | OK | Java 17 | TESTS | 15 | 326 | 716800 | ||
191609412 | this.is.shivamsingh | B | Feb. 1, 2023, 5:33 p.m. | OK | Java 17 | TESTS | 15 | 327 | 921600 | ||
191650717 | daftdove | B | Feb. 2, 2023, 3:33 a.m. | OK | Java 17 | TESTS | 15 | 358 | 1228800 | ||
191658088 | Vect_R | B | Feb. 2, 2023, 5:02 a.m. | OK | Java 17 | TESTS | 15 | 373 | 1228800 | ||
191631815 | Abdelrahman.M.3 | B | Feb. 1, 2023, 9:23 p.m. | OK | Java 17 | TESTS | 15 | 452 | 2867200 | ||
191650506 | kkz666 | B | Feb. 2, 2023, 3:29 a.m. | OK | Java 17 | TESTS | 15 | 545 | 12697600 | ||
191635878 | arpurush | B | Feb. 1, 2023, 10:40 p.m. | OK | Java 17 | TESTS | 15 | 545 | 12902400 | ||
191659293 | shahvraj1500 | B | Feb. 2, 2023, 5:19 a.m. | OK | Java 17 | TESTS | 15 | 623 | 14233600 | ||
191594277 | n0obie | B | Feb. 1, 2023, 4:06 p.m. | OK | Java 8 | TESTS | 15 | 186 | 0 | ||
191656778 | HMETAO | B | Feb. 2, 2023, 4:43 a.m. | OK | Java 8 | TESTS | 15 | 218 | 0 | ||
191627334 | lpychemistry | B | Feb. 1, 2023, 8:18 p.m. | OK | Java 8 | TESTS | 15 | 233 | 0 | ||
191607875 | depurador_ik | B | Feb. 1, 2023, 5:25 p.m. | OK | Java 8 | TESTS | 15 | 265 | 0 | ||
191596182 | HMETAO | B | Feb. 1, 2023, 4:12 p.m. | OK | Java 8 | TESTS | 15 | 265 | 0 | ||
191659466 | aggarwalanshul01 | B | Feb. 2, 2023, 5:21 a.m. | OK | Java 8 | TESTS | 15 | 311 | 2662400 | ||
191624211 | raj_shahh | B | Feb. 1, 2023, 7:38 p.m. | OK | Java 8 | TESTS | 15 | 358 | 6553600 | ||
191611389 | Swapniltri | B | Feb. 1, 2023, 5:44 p.m. | OK | Java 8 | TESTS | 15 | 420 | 6451200 | ||
191622580 | vaibhav_1710 | B | Feb. 1, 2023, 7:19 p.m. | OK | Java 8 | TESTS | 15 | 436 | 11366400 | ||
191611265 | Mohamed_Ahmed | B | Feb. 1, 2023, 5:43 p.m. | OK | Java 8 | TESTS | 15 | 561 | 6656000 | ||
191645193 | hua_yi_jiu | B | Feb. 2, 2023, 2:06 a.m. | OK | MS C++ 2017 | TESTS | 15 | 623 | 7987200 | ||
191659687 | SamleQ | B | Feb. 2, 2023, 5:23 a.m. | OK | MS C++ 2017 | TESTS | 15 | 639 | 1228800 | ||
191592731 | KuriyamaShiro | B | Feb. 1, 2023, 4:01 p.m. | OK | MS C++ 2017 | TESTS | 15 | 670 | 1638400 | ||
191608499 | adesh123 | B | Feb. 1, 2023, 5:28 p.m. | OK | MS C++ 2017 | TESTS | 15 | 780 | 4710400 | ||
191600477 | Galina_Basalova | B | Feb. 1, 2023, 4:26 p.m. | OK | MS C++ 2017 | TESTS | 15 | 1310 | 4198400 | ||
191597034 | ishybee | B | Feb. 1, 2023, 4:15 p.m. | OK | MS C++ 2017 | TESTS | 15 | 1326 | 3788800 | ||
191608411 | lollollollll | B | Feb. 1, 2023, 5:28 p.m. | OK | Node.js | TESTS | 15 | 342 | 39936000 | ||
191594268 | maxymczech | B | Feb. 1, 2023, 4:06 p.m. | OK | Node.js | TESTS | 15 | 420 | 43724800 | ||
191592808 | bvf | B | Feb. 1, 2023, 4:02 p.m. | OK | PyPy 3 | TESTS | 15 | 280 | 27238400 | ||
191594970 | Yash_Nandwana | B | Feb. 1, 2023, 4:08 p.m. | OK | PyPy 3 | TESTS | 15 | 404 | 28876800 | ||
191607310 | raideva | B | Feb. 1, 2023, 5:23 p.m. | OK | PyPy 3 | TESTS | 15 | 467 | 40038400 | ||
191615064 | star-1ord | B | Feb. 1, 2023, 6:09 p.m. | OK | PyPy 3 | TESTS | 15 | 701 | 18329600 | ||
191651285 | bpdolson | B | Feb. 2, 2023, 3:42 a.m. | OK | PyPy 3 | TESTS | 15 | 702 | 14438400 | ||
191619935 | welshman_11 | B | Feb. 1, 2023, 6:50 p.m. | OK | PyPy 3 | TESTS | 15 | 717 | 17920000 | ||
191600858 | WolG | B | Feb. 1, 2023, 4:27 p.m. | OK | PyPy 3 | TESTS | 15 | 733 | 18636800 | ||
191652667 | whitehost | B | Feb. 2, 2023, 4:03 a.m. | OK | PyPy 3 | TESTS | 15 | 733 | 31846400 | ||
191602600 | mohak_k | B | Feb. 1, 2023, 4:32 p.m. | OK | PyPy 3 | TESTS | 15 | 764 | 14438400 | ||
191602481 | hieuka2005 | B | Feb. 1, 2023, 4:32 p.m. | OK | PyPy 3 | TESTS | 15 | 779 | 32051200 | ||
191598963 | Jaya_Chaitanya | B | Feb. 1, 2023, 4:22 p.m. | OK | PyPy 3-64 | TESTS | 15 | 202 | 35635200 | ||
191621874 | sangeeta | B | Feb. 1, 2023, 7:11 p.m. | OK | PyPy 3-64 | TESTS | 15 | 217 | 26419200 | ||
191619161 | SophieHatter | B | Feb. 1, 2023, 6:43 p.m. | OK | PyPy 3-64 | TESTS | 15 | 218 | 40550400 | ||
191637583 | BrendanSGubbins | B | Feb. 1, 2023, 11:23 p.m. | OK | PyPy 3-64 | TESTS | 15 | 218 | 41062400 | ||
191626342 | Alex239 | B | Feb. 1, 2023, 8:05 p.m. | OK | PyPy 3-64 | TESTS | 15 | 218 | 41062400 | ||
191627283 | nealzane | B | Feb. 1, 2023, 8:17 p.m. | OK | PyPy 3-64 | TESTS | 15 | 233 | 26316800 | ||
191652615 | Youarenotgood | B | Feb. 2, 2023, 4:02 a.m. | OK | PyPy 3-64 | TESTS | 15 | 233 | 30720000 | ||
191615566 | gardengnome | B | Feb. 1, 2023, 6:13 p.m. | OK | PyPy 3-64 | TESTS | 15 | 234 | 23347200 | ||
191624181 | hvbird | B | Feb. 1, 2023, 7:38 p.m. | OK | PyPy 3-64 | TESTS | 15 | 249 | 30105600 | ||
191595518 | CinaDor | B | Feb. 1, 2023, 4:10 p.m. | OK | PyPy 3-64 | TESTS | 15 | 249 | 46080000 | ||
191595049 | DarkScorpion | B | Feb. 1, 2023, 4:09 p.m. | OK | Python 3 | TESTS | 15 | 545 | 11468800 | ||
191601809 | Omar.Gawdat | B | Feb. 1, 2023, 4:30 p.m. | OK | Python 3 | TESTS | 15 | 577 | 13414400 | ||
191596015 | elephant_trap | B | Feb. 1, 2023, 4:12 p.m. | OK | Python 3 | TESTS | 15 | 701 | 14745600 | ||
191592226 | sslift | B | Feb. 1, 2023, 4 p.m. | OK | Python 3 | TESTS | 15 | 748 | 14233600 | ||
191593236 | Rockey | B | Feb. 1, 2023, 4:03 p.m. | OK | Python 3 | TESTS | 15 | 763 | 13107200 | ||
191598574 | sunny_rivera | B | Feb. 1, 2023, 4:20 p.m. | OK | Python 3 | TESTS | 15 | 779 | 11571200 | ||
191620693 | Kladrr | B | Feb. 1, 2023, 6:58 p.m. | OK | Python 3 | TESTS | 15 | 795 | 13414400 | ||
191595860 | mathiaswk | B | Feb. 1, 2023, 4:11 p.m. | OK | Python 3 | TESTS | 15 | 857 | 11468800 | ||
191631709 | amanabiy | B | Feb. 1, 2023, 9:22 p.m. | OK | Python 3 | TESTS | 15 | 873 | 12697600 | ||
191593090 | Ysb04 | B | Feb. 1, 2023, 4:03 p.m. | OK | Python 3 | TESTS | 15 | 904 | 12288000 | ||
191627553 | liut | B | Feb. 1, 2023, 8:21 p.m. | OK | Rust 2021 | TESTS | 15 | 78 | 3072000 | ||
191600706 | minus400eq | B | Feb. 1, 2023, 4:27 p.m. | OK | Rust 2021 | TESTS | 15 | 233 | 12185600 |
Back to search problems