Codeforces Round 873 (Div. 2)

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
1828 Codeforces Round 873 (Div. 2) FINISHED False 7200 53191463 May 14, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 25049 ) B Permutation Swap PROGRAMMING math number theory 900

B'You are given an unsorted permutation p_1, p_2, ldots, p_n . To sort the permutation, you choose a constant k ( k ge 1 ) and do some operations on the permutation. In one operation, you can choose two integers i , j ( 1 <= j < i <= n ) such that i - j = k , then swap p_i and p_j . What is the maximum value of k that you can choose to sort the given permutation? 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). An unsorted permutation p is a permutation such that there is at least one position i that satisfies p_i ne i . 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 a single integer n ( 2 <= n <= 10^{5} ) -- the length of the permutation p . The second line of each test case contains n distinct integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n ) -- the permutation p . It is guaranteed that the given numbers form a permutation of length n and the given permutation is unsorted. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^{5} . For each test case, output the maximum value of k that you can choose to sort the given permutation. We can show that an answer always exists. In the first test case, the maximum value of k you can choose is 1 . The operations used to sort the permutation are: In the second test case, the maximum value of k you can choose is 2 . The operations used to sort the permutation are: '...

Tutorials

Codeforces Round #873 (Div. 1 & 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
206299139 fr0st B May 18, 2023, 5:21 a.m. OK C# 10 TESTS 15 93 11980800 900
206346014 hhsaffar B May 18, 2023, 1:32 p.m. OK C# 10 TESTS 15 139 13414400 900
206312658 loop42 B May 18, 2023, 8:13 a.m. OK C# 10 TESTS 15 218 14950400 900
206032850 bluemegane B May 15, 2023, 10:15 p.m. OK C# 8 TESTS 15 186 13516800 900
206005384 Hanahaha B May 15, 2023, 3:55 p.m. OK Clang++17 Diagnostics TESTS 15 264 24883200 900
206448269 Agin B May 19, 2023, 12:55 p.m. OK Clang++20 Diagnostics TESTS 15 748 409600 900
206201083 Aluomolo B May 17, 2023, 11:13 a.m. OK Clang++20 Diagnostics TESTS 15 780 0 900
205972340 Gkfjyn B May 15, 2023, 11:16 a.m. OK Clang++20 Diagnostics TESTS 15 857 1024000 900
206150756 swayingdream B May 16, 2023, 7:35 p.m. OK GNU C11 TESTS 15 46 1638400 900
205979426 qiqi_1 B May 15, 2023, 12:19 p.m. OK GNU C11 TESTS 15 62 0 900
206403221 kemirs B May 19, 2023, 4:33 a.m. OK GNU C11 TESTS 15 62 409600 900
205979726 qiqi_1 B May 15, 2023, 12:22 p.m. OK GNU C11 TESTS 15 78 409600 900
205969062 Seriously_Its_Sameer B May 15, 2023, 10:41 a.m. OK GNU C11 TESTS 15 78 409600 900
206012400 swimanonymous B May 15, 2023, 5:09 p.m. OK GNU C11 TESTS 15 78 819200 900
206172048 devgupta4105 B May 17, 2023, 5:10 a.m. OK GNU C11 TESTS 15 93 819200 900
206090910 HQLF B May 16, 2023, 1:09 p.m. OK GNU C11 TESTS 15 530 1638400 900
206050797 c1120231020 B May 16, 2023, 5:53 a.m. OK GNU C++14 TESTS 15 31 4096000 900
206104316 nhphucqt B May 16, 2023, 3:13 p.m. OK GNU C++14 TESTS 15 46 0 900
206170321 taraneh.abdellahi B May 17, 2023, 4:25 a.m. OK GNU C++14 TESTS 15 46 0 900
206212951 z7ayliga B May 17, 2023, 12:58 p.m. OK GNU C++14 TESTS 15 46 0 900
206223468 hqhlxj B May 17, 2023, 2:34 p.m. OK GNU C++14 TESTS 15 46 0 900
206360021 Naim_Hasan_Pappu B May 18, 2023, 3:38 p.m. OK GNU C++14 TESTS 15 46 0 900
206428674 hyj0824 B May 19, 2023, 9:35 a.m. OK GNU C++14 TESTS 15 46 0 900
206434568 Nomia B May 19, 2023, 10:35 a.m. OK GNU C++14 TESTS 15 46 0 900
206447886 sherry_.. B May 19, 2023, 12:52 p.m. OK GNU C++14 TESTS 15 46 0 900
206562176 sarthaknirgude01 B May 19, 2023, 7:02 p.m. OK GNU C++14 TESTS 15 46 0 900
206252691 nvarshney91 B May 17, 2023, 4:52 p.m. OK GNU C++17 TESTS 15 46 0 900
206209451 denni_08 B May 17, 2023, 12:26 p.m. OK GNU C++17 TESTS 15 46 0 900
206398430 leneza_41 B May 19, 2023, 3:01 a.m. OK GNU C++17 TESTS 15 46 0 900
206362848 Eivl_God B May 18, 2023, 4:06 p.m. OK GNU C++17 TESTS 15 46 0 900
206342269 Mazen_mohamed222 B May 18, 2023, 12:56 p.m. OK GNU C++17 TESTS 15 46 0 900
206341303 predik B May 18, 2023, 12:47 p.m. OK GNU C++17 TESTS 15 46 0 900
206334456 Amro_Sous B May 18, 2023, 11:46 a.m. OK GNU C++17 TESTS 15 46 0 900
206313653 Ujjwal_Ojha B May 18, 2023, 8:24 a.m. OK GNU C++17 TESTS 15 46 0 900
206293955 dbt10 B May 18, 2023, 3:39 a.m. OK GNU C++17 TESTS 15 46 0 900
206287793 OmegaZeus B May 18, 2023, 1:05 a.m. OK GNU C++17 TESTS 15 46 0 900
206173582 ___gcd B May 17, 2023, 5:46 a.m. OK GNU C++17 (64) TESTS 15 31 0 900
206046532 Oinng B May 16, 2023, 4:48 a.m. OK GNU C++17 (64) TESTS 15 31 0 900
205984770 omtrivedioo3 B May 15, 2023, 1:09 p.m. OK GNU C++17 (64) TESTS 15 31 0 900
205974703 LM1 B May 15, 2023, 11:37 a.m. OK GNU C++17 (64) TESTS 15 31 0 900
206408413 rky673 B May 19, 2023, 5:57 a.m. OK GNU C++17 (64) TESTS 15 31 409600 900
206250495 The5threich B May 17, 2023, 4:27 p.m. OK GNU C++17 (64) TESTS 15 31 409600 900
206158798 TokieSan B May 16, 2023, 10:21 p.m. OK GNU C++17 (64) TESTS 15 31 409600 900
205952928 Rakib03 B May 15, 2023, 7:36 a.m. OK GNU C++17 (64) TESTS 15 31 409600 900
206277989 kingkartik_7 B May 17, 2023, 7:53 p.m. OK GNU C++17 (64) TESTS 15 31 819200 900
206236798 sanbi52 B May 17, 2023, 3:43 p.m. OK GNU C++17 (64) TESTS 15 31 819200 900
206413815 NineTrackMind B May 19, 2023, 7:05 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206399221 yangKF B May 19, 2023, 3:17 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206417249 meet2107 B May 19, 2023, 7:45 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206418115 Osman_Bey B May 19, 2023, 7:53 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206421398 eucalyptus B May 19, 2023, 8:26 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206425418 avanguard B May 19, 2023, 9:04 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206437183 NathanaelSS B May 19, 2023, 11:05 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206440997 deltaPIRATE B May 19, 2023, 11:44 a.m. OK GNU C++20 (64) TESTS 15 31 0 900
206454713 a57495681800 B May 19, 2023, 2:01 p.m. OK GNU C++20 (64) TESTS 15 31 0 900
206454794 a57495681800 B May 19, 2023, 2:02 p.m. OK GNU C++20 (64) TESTS 15 31 0 900
206420541 koluchiy B May 19, 2023, 8:17 a.m. OK Go TESTS 15 93 3174400 900
206420804 koluchiy B May 19, 2023, 8:20 a.m. OK Go TESTS 15 108 3174400 900
205957835 _nathan_drake_ B May 15, 2023, 8:35 a.m. OK Go TESTS 15 109 2662400 900
205957584 _nathan_drake_ B May 15, 2023, 8:33 a.m. OK Go TESTS 15 109 2662400 900
206294603 Pranav_Sharda B May 18, 2023, 3:52 a.m. OK Java 11 TESTS 15 202 0 900
206199640 vijender_8601 B May 17, 2023, 10:59 a.m. OK Java 11 TESTS 15 202 0 900
206151655 kritikmodi B May 16, 2023, 7:49 p.m. OK Java 11 TESTS 15 233 0 900
205990856 FirstException B May 15, 2023, 1:36 p.m. OK Java 11 TESTS 15 233 40960000 900
206286494 amibaid B May 18, 2023, 12:15 a.m. OK Java 11 TESTS 15 249 0 900
206161657 TCchen B May 17, 2023, 12:15 a.m. OK Java 11 TESTS 15 249 0 900
206285007 aryankhatri B May 17, 2023, 11:12 p.m. OK Java 11 TESTS 15 265 0 900
206416135 hugewarriors B May 19, 2023, 7:33 a.m. OK Java 11 TESTS 15 265 3276800 900
206171844 AyazMost B May 17, 2023, 5:05 a.m. OK Java 11 TESTS 15 280 8704000 900
206009973 deepakanto B May 15, 2023, 4:41 p.m. OK Java 11 TESTS 15 342 11468800 900
206177891 dracarys_1105 B May 17, 2023, 6:58 a.m. OK Java 17 TESTS 15 233 2764800 900
205962343 SpareLin B May 15, 2023, 9:26 a.m. OK Java 17 TESTS 15 234 819200 900
205958429 _lwq_123_ B May 15, 2023, 8:43 a.m. OK Java 17 TESTS 15 248 0 900
205967502 q2045891621. B May 15, 2023, 10:22 a.m. OK Java 17 TESTS 15 249 307200 900
206057089 pandeyjii_11 B May 16, 2023, 7:18 a.m. OK Java 17 TESTS 15 264 409600 900
206058307 rated21 B May 16, 2023, 7:33 a.m. OK Java 17 TESTS 15 280 512000 900
206196466 shashank122343524 B May 17, 2023, 10:25 a.m. OK Java 17 TESTS 15 280 921600 900
205970153 Tiwwp8n24 B May 15, 2023, 10:53 a.m. OK Java 17 TESTS 15 280 4096000 900
206134243 meetsingh0202 B May 16, 2023, 4:32 p.m. OK Java 17 TESTS 15 311 409600 900
205972757 idonthatephy B May 15, 2023, 11:20 a.m. OK Java 17 TESTS 15 311 614400 900
206409302 magic_kid B May 19, 2023, 6:08 a.m. OK Java 8 TESTS 15 124 0 900
206294041 pxhero B May 18, 2023, 3:41 a.m. OK Java 8 TESTS 15 124 0 900
206187987 rezairianto B May 17, 2023, 8:54 a.m. OK Java 8 TESTS 15 124 0 900
206168295 chuquwan9964 B May 17, 2023, 3:35 a.m. OK Java 8 TESTS 15 124 0 900
206409121 magic_kid B May 19, 2023, 6:06 a.m. OK Java 8 TESTS 15 139 0 900
206096428 tejasS-27 B May 16, 2023, 1:58 p.m. OK Java 8 TESTS 15 155 0 900
206098181 Divyanshuverma21 B May 16, 2023, 2:14 p.m. OK Java 8 TESTS 15 170 0 900
206008092 ahmedhosny2002 B May 15, 2023, 4:22 p.m. OK Java 8 TESTS 15 186 0 900
205994111 GuoHangHeHe B May 15, 2023, 2:07 p.m. OK Java 8 TESTS 15 187 0 900
205954428 dsdkjwoejo B May 15, 2023, 7:55 a.m. OK Java 8 TESTS 15 187 204800 900
205952884 edchen B May 15, 2023, 7:35 a.m. OK Kotlin 1.7 TESTS 15 670 56627200 900
205993671 SlavaG B May 15, 2023, 2:03 p.m. OK Kotlin 1.7 TESTS 15 701 57241600 900
206306095 arkzuse B May 18, 2023, 6:57 a.m. OK Kotlin 1.7 TESTS 15 701 57446400 900
205993331 SlavaG B May 15, 2023, 2 p.m. OK Kotlin 1.7 TESTS 15 935 116326400 900
206282468 Gadi B May 17, 2023, 9:40 p.m. OK MS C++ 2017 TESTS 15 156 0 900
205952453 FZFFFFFF B May 15, 2023, 7:30 a.m. OK MS C++ 2017 TESTS 15 156 0 900
206095735 alex0511 B May 16, 2023, 1:51 p.m. OK MS C++ 2017 TESTS 15 156 1638400 900
206133321 SofiBorisova B May 16, 2023, 4:22 p.m. OK MS C++ 2017 TESTS 15 156 3481600 900
206139955 Ravitosh B May 16, 2023, 5:34 p.m. OK MS C++ 2017 TESTS 15 171 0 900
206102284 assure B May 16, 2023, 2:53 p.m. OK MS C++ 2017 TESTS 15 171 0 900
206008421 aacxx B May 15, 2023, 4:26 p.m. OK MS C++ 2017 TESTS 15 171 0 900
205977546 153floppa B May 15, 2023, 12:03 p.m. OK MS C++ 2017 TESTS 15 171 0 900
206134984 ShvarcstNeger B May 16, 2023, 4:43 p.m. OK MS C++ 2017 TESTS 15 171 1638400 900
206092429 shushukl B May 16, 2023, 1:23 p.m. OK MS C++ 2017 TESTS 15 186 819200 900
205998291 misorin B May 15, 2023, 2:45 p.m. OK PyPy 3 TESTS 15 124 12595200 900
206354768 Michele_T B May 18, 2023, 2:50 p.m. OK PyPy 3 TESTS 15 140 11673600 900
206080691 huyngoquang78 B May 16, 2023, 11:38 a.m. OK PyPy 3 TESTS 15 186 10956800 900
206050654 Genki123 B May 16, 2023, 5:51 a.m. OK PyPy 3 TESTS 15 202 10240000 900
206050732 Genki123 B May 16, 2023, 5:52 a.m. OK PyPy 3 TESTS 15 218 10649600 900
206050491 Genki123 B May 16, 2023, 5:49 a.m. OK PyPy 3 TESTS 15 358 13414400 900
206050454 Genki123 B May 16, 2023, 5:49 a.m. OK PyPy 3 TESTS 15 358 13516800 900
206451905 bilalboualam63 B May 19, 2023, 1:32 p.m. OK PyPy 3 TESTS 15 390 13824000 900
206009593 w313880557 B May 15, 2023, 4:38 p.m. OK PyPy 3 TESTS 15 420 13209600 900
206446448 flownn B May 19, 2023, 12:38 p.m. OK PyPy 3 TESTS 15 420 13414400 900
205973349 oneku16 B May 15, 2023, 11:25 a.m. OK PyPy 3-64 TESTS 15 93 16691200 900
206018237 SophieHatter B May 15, 2023, 6:12 p.m. OK PyPy 3-64 TESTS 15 93 20684800 900
206251270 JUBHAI B May 17, 2023, 4:36 p.m. OK PyPy 3-64 TESTS 15 108 18432000 900
205973190 oneku16 B May 15, 2023, 11:24 a.m. OK PyPy 3-64 TESTS 15 109 16588800 900
206160246 titia B May 16, 2023, 11:11 p.m. OK PyPy 3-64 TESTS 15 109 19148800 900
205950470 reijnnn B May 15, 2023, 7:06 a.m. OK PyPy 3-64 TESTS 15 109 19660800 900
206148037 Quick-One B May 16, 2023, 6:59 p.m. OK PyPy 3-64 TESTS 15 124 17203200 900
206039760 DarkTemplarDrop B May 16, 2023, 2:24 a.m. OK PyPy 3-64 TESTS 15 124 19456000 900
206443535 2100030666.cseh B May 19, 2023, 12:10 p.m. OK PyPy 3-64 TESTS 15 124 23142400 900
206318872 2000031264 B May 18, 2023, 9:16 a.m. OK PyPy 3-64 TESTS 15 124 23142400 900
206090256 itsme_ankit B May 16, 2023, 1:03 p.m. OK Python 3 TESTS 15 155 17305600 900
206321249 Eeezoe B May 18, 2023, 9:40 a.m. OK Python 3 TESTS 15 155 20480000 900
206067621 Block_Cipher B May 16, 2023, 9:24 a.m. OK Python 3 TESTS 15 170 16588800 900
206106980 CQ_cq B May 16, 2023, 3:39 p.m. OK Python 3 TESTS 15 171 16486400 900
206317795 Eeezoe B May 18, 2023, 9:05 a.m. OK Python 3 TESTS 15 171 16588800 900
206062235 2000030996-akanksha B May 16, 2023, 8:24 a.m. OK Python 3 TESTS 15 171 16588800 900
206075962 jainsaiyam2004 B May 16, 2023, 10:51 a.m. OK Python 3 TESTS 15 171 17510400 900
206244145 codestapler B May 17, 2023, 4:03 p.m. OK Python 3 TESTS 15 171 18022400 900
206324103 Eeezoe B May 18, 2023, 10:09 a.m. OK Python 3 TESTS 15 171 20480000 900
206323531 Eeezoe B May 18, 2023, 10:03 a.m. OK Python 3 TESTS 15 171 20480000 900
206316928 soudhamini_2000031088 B May 18, 2023, 8:57 a.m. OK Ruby 3 TESTS 15 763 15257600 900
206281422 phonk42 julykanyk Julia140 B May 17, 2023, 9:09 p.m. OK Ruby 3 TESTS 15 763 15257600 900
206010530 0x81 B May 15, 2023, 4:48 p.m. OK Ruby 3 TESTS 15 779 15257600 900
205968569 robostac B May 15, 2023, 10:35 a.m. OK Rust 2021 TESTS 15 31 3174400 900
205959639 ilyshana B May 15, 2023, 8:57 a.m. OK Rust 2021 TESTS 15 31 3174400 900
206455420 A_G B May 19, 2023, 2:08 p.m. OK Rust 2021 TESTS 15 31 7680000 900
206066453 Tardimgg B May 16, 2023, 9:12 a.m. OK Rust 2021 TESTS 15 46 2867200 900
206223093 Fawkes_li B May 17, 2023, 2:30 p.m. OK Rust 2021 TESTS 15 108 2048000 900
206034148 rodrigo_llanes B May 15, 2023, 10:58 p.m. OK Rust 2021 TESTS 15 108 2048000 900
206193931 atcoder8 B May 17, 2023, 9:57 a.m. OK Rust 2021 TESTS 15 108 3174400 900
206160445 A_G B May 16, 2023, 11:19 p.m. OK Rust 2021 TESTS 15 124 2048000 900

remove filters

Back to search problems