Codeforces Round 1030 (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
2118 Codeforces Round 1030 (Div. 2) FINISHED False 7200 26666723 June 12, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 280 ) F Shifts and Swaps PROGRAMMING graphs hashing strings

You are given arrays (a) and (b) of length (n) and an integer (m). The arrays only contain integers from (1) to (m), and both arrays contain all integers from (1) to (m). You may repeatedly perform either of the following operations on (a): cyclic shift(^{\text{∗}}) the array to the left swap two neighboring elements if their difference is at least (2). Is it possible to transform the first array into the second? (^{\text{∗}})A left cyclic shift of a zero-indexed array (p) of length (n) is an array (q) such that (q_i = p_{(i + 1) \bmod n}) for all (0 \le i < n). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^5)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((2 \le m \le n \le 5\cdot10^5)) — the length of the arrays and the number of distinct elements in (a). The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le m)) — denoting the array (a). The third line contains (n) integers (b_1, b_2, \ldots, b_n) ((1 \le b_i \le m)) — denoting the array (b). It is guaranteed that both arrays contain all integers from (1) to (m). It is guaranteed that the sum of (n) over all test cases does not exceed (5\cdot10^5). For each test case, output " YES " if it is possible to transform the first array into the second and " NO " otherwise. You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as positive responses. In the first test case, you can transform array (a) into array (b) with the following steps: (1), (2), (3) — shift to the left (2), (3), (1) — swap indices (2) and (3) (2), (1), (3) — shift to the left (1), (3), (2) — shift

Tutorials

Codeforces Round 1030 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
324149309 rohithsharmaa105 F June 12, 2025, 6:07 p.m. OK C++17 (GCC 7-32) TESTS 92 671 43008000
324150350 AA-2007 F June 12, 2025, 6:15 p.m. OK C++17 (GCC 7-32) TESTS 92 781 49152000
324183776 golions F June 13, 2025, 3:08 a.m. OK C++17 (GCC 7-32) TESTS 92 1061 113971200
324144464 vkant2802 F June 12, 2025, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 92 1155 44441600
324136339 StarSilk F June 12, 2025, 4:34 p.m. OK C++20 (GCC 13-64) TESTS 92 483 66560000
324143813 Shri_JSL F June 12, 2025, 5:30 p.m. OK C++20 (GCC 13-64) TESTS 92 624 69836800
324139401 anya_code F June 12, 2025, 5:07 p.m. OK C++20 (GCC 13-64) TESTS 92 1093 97177600
324168408 Edu175 F June 12, 2025, 9:42 p.m. OK C++20 (GCC 13-64) TESTS 92 1187 80179200
324196341 kuticpcer F June 13, 2025, 5:35 a.m. OK C++20 (GCC 13-64) TESTS 92 1468 124313600
324185249 andycoke F June 13, 2025, 3:29 a.m. OK C++20 (GCC 13-64) TESTS 92 1921 171929600
324164283 AItheGOAT F June 12, 2025, 8:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 500 29900800
324149030 m_conq F June 12, 2025, 6:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 593 69939200
324148952 mfaiz_1 F June 12, 2025, 6:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 593 69939200
324154318 arvindk0025 F June 12, 2025, 6:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 624 70041600
324177898 ian_HLX F June 13, 2025, 1:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 92 828 148172800
324157111 henotrix F June 12, 2025, 7:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 921 58777600
324164372 tin.le2 F June 12, 2025, 8:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 999 63385600
324176140 LMydd0225 F June 13, 2025, 1:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 92 1031 170905600
324191947 A_G F June 13, 2025, 4:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 92 1046 42598400
324179097 phtniit F June 13, 2025, 1:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 92 1296 62668800
324153390 Dukkha F June 12, 2025, 6:40 p.m. OK Java 21 TESTS 92 2562 47104000
324167244 golomb F June 12, 2025, 9:19 p.m. OK PyPy 3-64 TESTS 92 1686 112025600
324141597 ValeriyShiyan F June 12, 2025, 5:17 p.m. OK PyPy 3-64 TESTS 92 3546 248934400

remove filters

Back to search problems