Codeforces Global Round 26

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
1984 Codeforces Global Round 26 FINISHED False 10800 13879499 June 9, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 260 ) G Magic Trick II PROGRAMMING constructive algorithms implementation sortings

B"The secret behind Oscar's first magic trick has been revealed! Because he still wants to impress Lura, he comes up with a new idea: he still wants to sort a permutation p_1, p_2, ldots, p_n of [1, 2, ldots, n] . This time, he chooses an integer k . He wants to sort the permutation in non-decreasing order using the following operation several times: To be as impressive as possible, Oscar would like to choose the maximal value of k such that he can sort his permutation. Please help him find the maximal k as well as a sequence of operations that will sort the permutation. You don't need to minimize the number of operations, but you are allowed to use at most 5n^2 operations. We have a proof that, for the maximal k such that you can sort the permutation in any number of operations, you can also sort it in at most 5n^2 operations. The first line contains a single integer t ( 1 <= q t <= q 10^3 ) -- the number of test cases. The first line of each test case contains a single integer n ( 5 <= q n <= q 10^3 ) -- the length of the permutation. The second line of each test case contains a permutation p_1, p_2, ldots, p_n of [1, 2, ldots, n] . The sum of n over all test cases does not exceed 2 cdot 10^3 . For each test case, first output the chosen value of k on a new line ( 1 <= q k <= q n ). Then, output a single integer m -- the number of operations used ( 0 <= q m <= q 5n^2 ). Then, on each of the next m lines, output the operations denoted by two integers i and j ( 1 <= q i, j <= q n - k + 1 ), representing an operation where you remove the subarray starting from index i and replace it back into p at index j . In the first test case, it is enough to move the last four numbers to the front. In the second test case, it can be shown that we cannot have k = 4 or k = 5 . With k = 3 , we can move"...

Tutorials

Codeforces Global Round 26 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
264960813 kiwihadron G June 9, 2024, 5:29 p.m. OK C++14 (GCC 6-32) TESTS 16 889 21811200
264996098 hank55663 G June 10, 2024, 3:43 a.m. OK C++17 (GCC 7-32) TESTS 16 187 3481600
264987908 Kilani G June 10, 2024, 1:17 a.m. OK C++17 (GCC 7-32) TESTS 16 249 9011200
265006484 the_Despair_ G June 10, 2024, 5:52 a.m. OK C++17 (GCC 7-32) TESTS 16 264 11366400
264967484 ksun48 G June 9, 2024, 6:49 p.m. OK C++17 (GCC 7-32) TESTS 16 311 12697600
264962631 Szoboszlai10 G June 9, 2024, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 16 374 21811200
264957466 stepanov.aa G June 9, 2024, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 16 436 21811200
264987474 fanhaoxuan G June 10, 2024, 1:05 a.m. OK C++17 (GCC 7-32) TESTS 16 453 21913600
264959509 RNS_KSR G June 9, 2024, 5:25 p.m. OK C++17 (GCC 7-32) TESTS 16 546 24780800
264960473 PubabaOnO G June 9, 2024, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 16 859 50790400
264969262 QwertyPi G June 9, 2024, 7:05 p.m. OK C++17 (GCC 7-32) TESTS 16 1124 22425600
264961633 kotatsugame G June 9, 2024, 5:32 p.m. OK C++20 (GCC 13-64) TESTS 16 186 9523200
264975623 PinkieRabbit G June 9, 2024, 8:26 p.m. OK C++20 (GCC 13-64) TESTS 16 187 10035200
264973574 PinkieRabbit G June 9, 2024, 7:57 p.m. OK C++20 (GCC 13-64) TESTS 16 187 10035200
264967490 PinkieRabbit G June 9, 2024, 6:49 p.m. OK C++20 (GCC 13-64) TESTS 16 187 10035200
264973130 PinkieRabbit G June 9, 2024, 7:52 p.m. OK C++20 (GCC 13-64) TESTS 16 202 10035200
264973108 PinkieRabbit G June 9, 2024, 7:52 p.m. OK C++20 (GCC 13-64) TESTS 16 202 10035200
264956405 ecnerwala G June 9, 2024, 5:14 p.m. OK C++20 (GCC 13-64) TESTS 16 202 36761600
264968624 Mangooste G June 9, 2024, 6:59 p.m. OK C++20 (GCC 13-64) TESTS 16 234 14131200
264968737 Mangooste G June 9, 2024, 7 p.m. OK C++20 (GCC 13-64) TESTS 16 249 14131200
264956217 asdsasd G June 9, 2024, 5:13 p.m. OK C++20 (GCC 13-64) TESTS 16 281 10649600
264967277 arvindf232 G June 9, 2024, 6:47 p.m. OK Kotlin 1.9 TESTS 16 1218 218624000

remove filters

Back to search problems