Codeforces Global Round 27

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
2035 Codeforces Global Round 27 FINISHED False 10800 46452282 Oct. 27, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 96 ) H Peak Productivity Forces PROGRAMMING constructive algorithms

You are given two permutations(^{\text{∗}}) (a) and (b), both of length (n). You can perform the following three-step operation on permutation (a): Choose an index (i) ((1 \le i \le n)). Cyclic shift (a_1, a_2, \ldots, a_{i-1}) by (1) to the right. If you had chosen (i = 1), then this range doesn't exist, and you cyclic shift nothing. Cyclic shift (a_{i + 1}, a_{i + 2}, \ldots, a_n) by (1) to the right. If you had chosen (i = n), then this range doesn't exist, and you cyclic shift nothing. After the operation, (a_1,a_2,\ldots, a_{i-2},a_{i-1},a_i,a_{i + 1}, a_{i + 2},\ldots,a_{n-1}, a_n) is transformed into (a_{i-1},a_1,\ldots,a_{i-3},a_{i-2},a_i,a_n, a_{i + 1},\ldots,a_{n-2}, a_{n-1}). Here are some examples of operations done on the identity permutation (1,2,3,4,5,6,7) of length (7): If we choose (i = 3), it will become (2, 1, 3, 7, 4, 5, 6). If we choose (i = 1), it will become (1, 7, 2, 3, 4, 5, 6). If we choose (i = 7), it will become (6, 1, 2, 3, 4, 5, 7). Find a construction using at most (2n) operations to make (a) equal to (b) or print (-1) if it is impossible. The number of operations does not need to be minimized. It can be shown that if it is possible to make (a) equal to (b), it is possible to do this within (2n) operations. (^{\text{∗}})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 \le t \le 5 \cdot 10^4)) — the number of test cases. The first line of each test case contains a single integer (n) ((1 \le n \le 5 \cdot 10^5)) — the lengths of permutations $$

Tutorials

Codeforces Global Round 27 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
288385907 Kiriller228 H Oct. 27, 2024, 7:04 p.m. OK C++17 (GCC 7-32) TESTS 88 390 18534400
288408704 Ion_Gravirei H Oct. 28, 2024, 1:56 a.m. OK C++17 (GCC 7-32) TESTS 88 390 19046400
288397713 Hori H Oct. 27, 2024, 9:16 p.m. OK C++20 (GCC 13-64) TESTS 88 296 25088000
288413430 Dilip1234__213 H Oct. 28, 2024, 3:25 a.m. OK C++20 (GCC 13-64) TESTS 88 327 14643200
288385210 Now_Sashak H Oct. 27, 2024, 6:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 296 14643200
288373417 orz H Oct. 27, 2024, 5:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 296 14643200
288421376 _MASSIMO_ H Oct. 28, 2024, 5:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 343 23552000
288418519 lazyyyyy H Oct. 28, 2024, 4:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 905 8089600
288382647 pikachu_0OW H Oct. 27, 2024, 6:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 906 8089600
288381089 rainboy H Oct. 27, 2024, 6:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 921 8089600

remove filters

Back to search problems