Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + 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
2229 Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + Div. 2) FINISHED False 10800 833086 May 23, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 15421 ) A Slimes on a Line PROGRAMMING brute force greedy math

There are (n) slimes on a line, where slime (i) is at position (a_i) on the line. You will perform the following operation some number of times (possibly none): select an integer (x), then for each (j) ((1 \le j \le n)): if (a_j \lt x) then do (a_j := a_j + 1). if (a_j \gt x) then do (a_j := a_j - 1). if (a_j = x) then do nothing. if (a_j \lt x) then do (a_j := a_j + 1). if (a_j \gt x) then do (a_j := a_j - 1). if (a_j = x) then do nothing. Determine the minimum number of operations to make all slimes occupy the same position. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line of each testcase contains an integer (n) ((2 \le n \le 1000)) — the number of slimes. The second line of each testcase contains (n) integers (a_1,a_2,\ldots,a_{n}) ((1 \le a_i \le 1000)) — the initial positions of the slimes. It is guaranteed that the sum of (n) over all test cases does not exceed (1000). For each testcase, output the minimum number of operations required to make all slimes occupy the same position. Test Case 1: We can perform (2) operations, both with (x = 3). The first operation updates the array of positions to (a = 2, 3, 3, 3, 4), and then the second operation updates it to (a = 3, 3, 3, 3, 3). Test Case 2: All the slimes are already at position (3), and hence (0) operations are needed.

Tutorials

Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
375893516 Yank233 A May 24, 2026, 6:08 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375893402 Sushant_prashar A May 24, 2026, 6:07 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375891190 jihan19 A May 24, 2026, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375887463 itsatul__ A May 24, 2026, 4:44 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375887151 dragonalt A May 24, 2026, 4:39 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375887047 Prakhar1947 A May 24, 2026, 4:37 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375886776 GGL_DK A May 24, 2026, 4:32 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375886504 imSNP A May 24, 2026, 4:27 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375885653 K_Brishty A May 24, 2026, 4:12 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
375885294 Rhea_29 A May 24, 2026, 4:05 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0

remove filters

Back to search problems