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 |
|---|---|---|---|---|---|---|
| 2165 | Codeforces Round 1064 (Div. 1) | FINISHED | False | 7200 | 13101923 | Nov. 16, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 881 ) | D | Path Split | PROGRAMMING | dp graph matchings greedy |
You are given a sequence of (n) integers (a_1,a_2,\ldots,a_n). You would like to partition (a) into several subsequences (^{\text{∗}}) (b_1,b_2,\ldots,b_k), satisfying the following conditions: Each element in (a) belongs to exactly one of (b_i). For each sequence (b_i), let its elements be (b_{i,1},b_{i,2},\ldots,b_{i,p_i}). For every (1\le j<p_i), (|b_{i,j}-b_{i,j+1}|=1) should hold. Please calculate the minimum number of subsequences you can partition (a) into. (^{\text{∗}})A sequence (b_i) is a subsequence of a sequence (a) if (b_i) can be obtained from (a) by the deletion of several (possibly, zero or all) element from arbitrary positions. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1\le n\le10^6)) — the length of the sequence (a). The second line of each test case contains (n) integers (a_1,a_2,\ldots,a_n) ((1\le a_i\le2n)) — the sequence (a). It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each test case, print a single integer on one line — the minimum number of subsequences (a) can be partitioned into. In the first test case, we can partition (a) into subsequences (1). It is obvious that we cannot partition (a) into fewer subsequences; thus, (1) is the answer. In the third test case, we can partition (a) into subsequences (11,10,11,10,13,11,11,13). Please note that (11,10,11,11,11,10) is not a valid sequence, since (|11-11|=0\neq1). |
| 148452 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 349319470 | Kieray | D | Nov. 16, 2025, 4:20 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 515 | 24064000 | ||
| 349326715 | ywjylx | D | Nov. 16, 2025, 5:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 608 | 40550400 | ||
| 349315389 | oceeff | D | Nov. 16, 2025, 4:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 608 | 65740800 | ||
| 349327214 | TheSahib | D | Nov. 16, 2025, 5:12 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 640 | 35532800 | ||
| 349319231 | tanmuling0429 | D | Nov. 16, 2025, 4:19 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 781 | 86732800 | ||
| 349308674 | Az3ar | D | Nov. 16, 2025, 3:46 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 796 | 33792000 | ||
| 349301033 | potato167 | D | Nov. 16, 2025, 3:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 890 | 9420800 | ||
| 349370334 | Broder | D | Nov. 17, 2025, 4:04 a.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 984 | 124620800 | ||
| 349327696 | panospask | D | Nov. 16, 2025, 5:15 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 1046 | 85708800 | ||
| 349310146 | DizzyGroovy | D | Nov. 16, 2025, 3:50 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 1062 | 83353600 | ||
| 349349073 | maxplus | D | Nov. 16, 2025, 9:11 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 124 | 16179200 | ||
| 349343799 | maxplus | D | Nov. 16, 2025, 7:50 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 140 | 20172800 | ||
| 349343673 | maxplus | D | Nov. 16, 2025, 7:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 249 | 20172800 | ||
| 349343166 | maxplus | D | Nov. 16, 2025, 7:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 327 | 22118400 | ||
| 349313585 | www_bilibili_com | D | Nov. 16, 2025, 4:01 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 452 | 73932800 | ||
| 349342553 | maxplus | D | Nov. 16, 2025, 7:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 499 | 9318400 | ||
| 349300706 | turkhuu622 | D | Nov. 16, 2025, 3:25 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 531 | 63180800 | ||
| 349306017 | ender_shayan | D | Nov. 16, 2025, 3:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 531 | 69836800 | ||
| 349319611 | YoshikaMiyafuji | D | Nov. 16, 2025, 4:20 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 577 | 85913600 | ||
| 349301211 | gamegame | D | Nov. 16, 2025, 3:26 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 593 | 70860800 | ||
| 349323759 | lnsuyn | D | Nov. 16, 2025, 4:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 406 | 35635200 | ||
| 349324274 | cooluo | D | Nov. 16, 2025, 4:34 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 499 | 70963200 | ||
| 349300163 | JDScript0117 | D | Nov. 16, 2025, 3:24 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 499 | 74956800 | ||
| 349331818 | DivineLife | D | Nov. 16, 2025, 5:48 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 530 | 65024000 | ||
| 349294902 | Nachia | D | Nov. 16, 2025, 3:12 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 546 | 61952000 | ||
| 349334082 | JeanBombeur | D | Nov. 16, 2025, 6:07 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 546 | 71065600 | ||
| 349338523 | Papaver | D | Nov. 16, 2025, 6:48 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 546 | 102092800 | ||
| 349320511 | BlueBottle | D | Nov. 16, 2025, 4:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 577 | 17817600 | ||
| 349320838 | zhouyuheng2009 | D | Nov. 16, 2025, 4:24 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 609 | 71065600 | ||
| 349315740 | potatoo | D | Nov. 16, 2025, 4:08 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 624 | 62976000 | ||
| 349321881 | nathanballman | D | Nov. 16, 2025, 4:28 p.m. | OK | Java 21 | TESTS | 37 | 3983 | 178790400 | ||
| 349311382 | Tlatoani | D | Nov. 16, 2025, 3:54 p.m. | OK | Kotlin 2.2 | TESTS | 37 | 2733 | 302796800 |
Back to search problems