Codeforces Round 1002 (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
2059 Codeforces Round 1002 (Div. 2) FINISHED False 7200 37898722 Feb. 2, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 348 ) E2 Stop Gaming (Hard Version) PROGRAMMING brute force constructive algorithms data structures

This is the hard version of the problem. The difference between the versions is that in this version you need to output all the operations that need to be performed. You can hack only if you solved all versions of this problem. You are given (n) arrays, each of which has a length of (m). Let the (j)-th element of the (i)-th array be denoted as (a_{i, j}). It is guaranteed that all (a_{i, j}) are pairwise distinct . In one operation, you can do the following: Choose some integer (i) ((1 \le i \le n)) and an integer (x) ((1 \le x \le 2 \cdot n \cdot m)). For all integers (k) from (i) to (n) in increasing order, do the following: Add the element (x) to the beginning of the (k)-th array. Assign (x) the value of the last element in the (k)-th array. Remove the last element from the (k)-th array. Add the element (x) to the beginning of the (k)-th array. Assign (x) the value of the last element in the (k)-th array. Remove the last element from the (k)-th array. In other words, you can insert an element at the beginning of any array, after which all elements in this and all following arrays are shifted by one to the right. The last element of the last array is removed. You are also given a description of the arrays that need to be obtained after all operations. That is, after performing the operations, the (j)-th element of the (i)-th array should be equal to (b_{i, j}). It is guaranteed that all (b_{i, j}) are pairwise distinct . Determine the minimum number of operations that need to be performed to obtain the desired arrays, and also output the sequence of all operations itself. Each test consists of multiple test cases. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ($$$1 \le n, m \le

Tutorials

139094

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
304252441 berr E2 Feb. 3, 2025, 1:05 p.m. OK C++17 (GCC 7-32) TESTS 44 249 8499200
304205276 Teja-Smart E2 Feb. 3, 2025, 4:11 a.m. OK C++17 (GCC 7-32) TESTS 44 249 23347200
304282351 Ste E2 Feb. 3, 2025, 4:02 p.m. OK C++17 (GCC 7-32) TESTS 44 280 8704000
304181467 ender_shayan E2 Feb. 2, 2025, 8:45 p.m. OK C++17 (GCC 7-32) TESTS 44 281 39014400
304271746 shaoxing_moon E2 Feb. 3, 2025, 2:57 p.m. OK C++17 (GCC 7-32) TESTS 44 359 28876800
304205806 PeruvianCartel E2 Feb. 3, 2025, 4:19 a.m. OK C++17 (GCC 7-32) TESTS 44 421 17612800
304270026 gevak E2 Feb. 3, 2025, 2:47 p.m. OK C++17 (GCC 7-32) TESTS 44 671 30208000
304211887 TianyiWei E2 Feb. 3, 2025, 5:35 a.m. OK C++17 (GCC 7-32) TESTS 44 749 51404800
304252260 berr E2 Feb. 3, 2025, 1:04 p.m. OK C++20 (GCC 13-64) TESTS 44 187 8499200
304184965 zeemanz E2 Feb. 2, 2025, 9:30 p.m. OK C++20 (GCC 13-64) TESTS 44 187 10649600
304293804 kaiboy E2 Feb. 3, 2025, 5:18 p.m. OK C++20 (GCC 13-64) TESTS 44 202 7270400
304250540 berr E2 Feb. 3, 2025, 12:52 p.m. OK C++20 (GCC 13-64) TESTS 44 218 8499200
304269748 jeff_qi E2 Feb. 3, 2025, 2:46 p.m. OK C++20 (GCC 13-64) TESTS 44 218 19353600
304193121 coldminded E2 Feb. 3, 2025, 12:04 a.m. OK C++20 (GCC 13-64) TESTS 44 218 19968000
304257042 jtrh E2 Feb. 3, 2025, 1:33 p.m. OK C++20 (GCC 13-64) TESTS 44 218 31129600
304249940 berr E2 Feb. 3, 2025, 12:48 p.m. OK C++20 (GCC 13-64) TESTS 44 233 11161600
304316962 ContronThePanda E2 Feb. 3, 2025, 8:10 p.m. OK C++20 (GCC 13-64) TESTS 44 234 19046400
304263716 Misty7 E2 Feb. 3, 2025, 2:13 p.m. OK C++20 (GCC 13-64) TESTS 44 249 20172800
304308835 Tatva E2 Feb. 3, 2025, 6:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 171 3993600
304199868 prairie2022 E2 Feb. 3, 2025, 2:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 187 7168000
304323302 jlass_ E2 Feb. 3, 2025, 9:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 187 9932800
304322303 jlass_ E2 Feb. 3, 2025, 9:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 187 10137600
304252498 berr E2 Feb. 3, 2025, 1:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 218 8601600
304185867 wakaka E2 Feb. 2, 2025, 9:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 24064000
304327768 guperman E2 Feb. 3, 2025, 10:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 40243200
304184724 wakaka E2 Feb. 2, 2025, 9:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 265 23961600
304289593 Ali_cs7 E2 Feb. 3, 2025, 4:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 296 26419200
304258208 Str_ywr E2 Feb. 3, 2025, 1:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 296 45260800
304343134 The_Bharadwaj E2 Feb. 4, 2025, 4:17 a.m. OK Node.js TESTS 44 608 135577600
304225222 nwblanton E2 Feb. 3, 2025, 9:32 a.m. OK PyPy 3-64 TESTS 44 2031 91648000

remove filters

Back to search problems