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 |
|---|---|---|---|---|---|---|
| 2085 | Codeforces Round 1011 (Div. 2) | FINISHED | False | 7200 | 33751523 | March 22, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 753 ) | F1 | Serval and Colorful Array (Easy Version) | PROGRAMMING | data structures greedy |
This is the easy version of the problem. The difference between the versions is that in this version, (n\le 3000). You can hack only if you solved all versions of this problem. Serval has a magic number (k) ((k\ge 2)). We call an array (r) colorful if and only if: The length of (r) is (k), and Each integer between (1) and (k) appears exactly once in (r). You are given an array (a) consisting of (n) integers between (1) and (k). It is guaranteed that each integer between (1) and (k) appears in (a) at least once. You can perform the following operation on (a): Choose an index (i) ((1\le i < n)), then swap (a_i) and (a_{i+1}). Find the minimum number of operations needed to make at least one subarray(^{\text{∗}}) of (a) colorful . It can be shown that this is always possible under the constraints of the problem. (^{\text{∗}})An array (b) is a subarray of an array (a) if (b) can be obtained from (a) by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains two integers (n) and (k) ((2\leq k\leq n\leq 3000)) — the length of the array (a) and Serval's magic number. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1\leq a_i\leq k)) — the elements of the array (a). It is guaranteed that each integer between (1) and (k) appears in (a) at least once. It is guaranteed that the sum of (n) over all test cases does not exceed (3000). For each test case, output a single integer — the minimum number of operations needed to make at least one subarray of (a) colorful . In the first test case, since the subarrays |
| Codeforces Round #1011 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 311954594 | sheep32768 | F1 | March 23, 2025, 4:35 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 46 | 12902400 | ||
| 311944848 | mandy0109 | F1 | March 23, 2025, 1:58 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 61 | 9625600 | ||
| 311952178 | ywjylx | F1 | March 23, 2025, 4:01 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 62 | 9728000 | ||
| 311945293 | Umiyuri | F1 | March 23, 2025, 2:06 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 77 | 204800 | ||
| 311932447 | EL_DOKSH | F1 | March 22, 2025, 10:01 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 109 | 0 | ||
| 311907336 | StrayDog123 | F1 | March 22, 2025, 6:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 109 | 0 | ||
| 311947065 | cube_escape | F1 | March 23, 2025, 2:37 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 124 | 102400 | ||
| 311941879 | Axial-Tilted | F1 | March 23, 2025, 12:47 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 140 | 102400 | ||
| 311934107 | abeker | F1 | March 22, 2025, 10:20 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 171 | 0 | ||
| 311937880 | abeker | F1 | March 22, 2025, 11:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 328 | 102400 | ||
| 311938165 | Rayo | F1 | March 22, 2025, 11:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 0 | ||
| 311954521 | xly_tyty | F1 | March 23, 2025, 4:34 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 102400 | ||
| 311916082 | C12AK | F1 | March 22, 2025, 7:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 102400 | ||
| 311906821 | NuclearMint | F1 | March 22, 2025, 6:07 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 102400 | ||
| 311906044 | tin.le2 | F1 | March 22, 2025, 6:01 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 102400 | ||
| 311902559 | luuia | F1 | March 22, 2025, 5:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 102400 | ||
| 311900093 | sdyakonov | F1 | March 22, 2025, 5:21 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 102400 | ||
| 311911900 | Alwoosh | F1 | March 22, 2025, 6:49 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 2457600 | ||
| 311925231 | Boy.Man | F1 | March 22, 2025, 8:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 12697600 | ||
| 311960036 | StarSilk | F1 | March 23, 2025, 5:33 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 62 | 22528000 |
Back to search problems