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
( 882 ) E1 Stop Gaming (Easy Version) PROGRAMMING brute force constructive algorithms greedy hashing

This is the easy version of the problem. The difference between the versions is that in this version you only need to find the minimum number of operations. 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. 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 3 \cdot 10^5)) — the number of arrays and the number of eleme

Tutorials

139094

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
304199117 n0sk1ll E1 Feb. 3, 2025, 2:26 a.m. OK C++17 (GCC 7-32) TESTS 44 155 2457600
304328563 --Pavel-- E1 Feb. 3, 2025, 10:53 p.m. OK C++17 (GCC 7-32) TESTS 44 171 102400
304278617 djsksbrbf E1 Feb. 3, 2025, 3:39 p.m. OK C++17 (GCC 7-32) TESTS 44 171 102400
304212058 wistful23 E1 Feb. 3, 2025, 5:37 a.m. OK C++17 (GCC 7-32) TESTS 44 171 2355200
304209783 doraji_muchim E1 Feb. 3, 2025, 5:10 a.m. OK C++17 (GCC 7-32) TESTS 44 171 2457600
304214202 MMihalev E1 Feb. 3, 2025, 7:45 a.m. OK C++17 (GCC 7-32) TESTS 44 171 3993600
304284234 mrfoxygmfr E1 Feb. 3, 2025, 4:15 p.m. OK C++17 (GCC 7-32) TESTS 44 186 2457600
304273576 lenhanbounofficial E1 Feb. 3, 2025, 3:08 p.m. OK C++17 (GCC 7-32) TESTS 44 186 17100800
304286298 chennie E1 Feb. 3, 2025, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 44 187 4915200
304232711 gevak E1 Feb. 3, 2025, 10:33 a.m. OK C++17 (GCC 7-32) TESTS 44 202 3686400
304284849 dsogari E1 Feb. 3, 2025, 4:19 p.m. OK C++20 (GCC 13-64) TESTS 44 140 102400
304278109 dsogari E1 Feb. 3, 2025, 3:35 p.m. OK C++20 (GCC 13-64) TESTS 44 140 102400
304271515 MintCat E1 Feb. 3, 2025, 2:55 p.m. OK C++20 (GCC 13-64) TESTS 44 140 102400
304247124 sheyigang E1 Feb. 3, 2025, 12:26 p.m. OK C++20 (GCC 13-64) TESTS 44 140 102400
304191578 CacheMe E1 Feb. 2, 2025, 11:27 p.m. OK C++20 (GCC 13-64) TESTS 44 140 102400
304219946 _DRVGON_ E1 Feb. 3, 2025, 8:48 a.m. OK C++20 (GCC 13-64) TESTS 44 140 1126400
304180183 _Sherbiny E1 Feb. 2, 2025, 8:30 p.m. OK C++20 (GCC 13-64) TESTS 44 140 1126400
304206077 Sunnatov E1 Feb. 3, 2025, 4:22 a.m. OK C++20 (GCC 13-64) TESTS 44 140 1433600
304203426 ChengyunSun E1 Feb. 3, 2025, 3:45 a.m. OK C++20 (GCC 13-64) TESTS 44 140 2457600
304218044 gqf E1 Feb. 3, 2025, 8:29 a.m. OK C++20 (GCC 13-64) TESTS 44 140 2969600
304201503 cooluo E1 Feb. 3, 2025, 3:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 77 5734400
304310094 nzo E1 Feb. 3, 2025, 7:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 140 0
304326930 Marios.K.R.Marouditsis E1 Feb. 3, 2025, 10:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 140 102400
304184245 wakaka E1 Feb. 2, 2025, 9:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 140 1228800
304232850 gevak E1 Feb. 3, 2025, 10:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 140 3686400
304241106 gevak E1 Feb. 3, 2025, 11:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 140 4915200
304223667 Valters07 E1 Feb. 3, 2025, 9:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 155 102400
304187809 Shafiullah_Raihan E1 Feb. 2, 2025, 10:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 155 102400
304242823 danbanica E1 Feb. 3, 2025, 11:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 155 1228800
304258969 OutsiderZz E1 Feb. 3, 2025, 1:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 155 5529600
304320267 uffhottie E1 Feb. 3, 2025, 8:45 p.m. OK Go TESTS 44 140 15155200
304317293 uffhottie E1 Feb. 3, 2025, 8:14 p.m. OK Go TESTS 44 140 15155200
304214259 shre99 E1 Feb. 3, 2025, 7:46 a.m. OK Java 21 TESTS 44 468 6758400
304201976 InfinityX E1 Feb. 3, 2025, 3:21 a.m. OK Java 8 TESTS 44 249 13721600
304205224 The_Bharadwaj E1 Feb. 3, 2025, 4:10 a.m. OK Node.js TESTS 44 750 204185600
304201069 VSS201831_Subtain E1 Feb. 3, 2025, 3:05 a.m. OK PyPy 3 TESTS 44 827 58163200
304310188 gardengnome E1 Feb. 3, 2025, 7:09 p.m. OK PyPy 3-64 TESTS 44 483 72089600
304269019 FZANOTFOUND E1 Feb. 3, 2025, 2:41 p.m. OK PyPy 3-64 TESTS 44 983 61132800
304220446 nwblanton E1 Feb. 3, 2025, 8:53 a.m. OK PyPy 3-64 TESTS 44 1311 88166400

remove filters

Back to search problems