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 |
---|---|---|---|---|---|---|
1527 | Codeforces Round 721 (Div. 2) | FINISHED | False | 7200 | 115745063 | May 20, 2021, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 2401 ) | E | Partition Game | PROGRAMMING | binary search data structures divide and conquer dp | #Passwords | 2500 |
B'You are given an array a of n integers. Define the cost of some array t as follows: cost(t) = sum_{x in set(t) } last(x) - first(x), where set(t) is the set of all values in t without repetitions, first(x) , and last(x) are the indices of the first and last occurrence of x in t , respectively. In other words, we compute the distance between the first and last occurrences for each distinct element and sum them up. You need to split the array a into k consecutive segments such that each element of a belongs to exactly one segment and the sum of the cost of individual segments is minimum. The first line contains two integers n , k ( 1 <= n <= 35 ,000 , 1 <= k <= min(n,100) ). The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ). Output the minimum sum of the cost of individual segments. In the first example, we can divide the array into [1,6,6,4] and [6,6,6] . Cost of [1,6,6,4] will be (1-1) + (3 - 2) + (4-4) = 1 and cost of [6,6,6] will be 3-1 = 2 . Total cost would be 1 + 2 = 3 . In the second example, divide the array into [5,5],[5],[5,2,3] and [3] . Total Cost would be 1 + 0 + 0 + 0 = 1 . '... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
116858655 | rainboy | E | May 20, 2021, 8:22 p.m. | OK | GNU C11 | TESTS | 101 | 62 | 1126400 | 2500 | |
116858462 | rainboy | E | May 20, 2021, 8:18 p.m. | OK | GNU C11 | TESTS | 101 | 62 | 1433600 | 2500 | |
116858473 | rainboy | E | May 20, 2021, 8:19 p.m. | OK | GNU C11 | TESTS | 101 | 77 | 1433600 | 2500 | |
116845260 | zhuzhirui2005 | E | May 20, 2021, 5:34 p.m. | OK | GNU C++11 | TESTS | 101 | 499 | 161280000 | 2500 | |
116868373 | ig-TheShy | E | May 21, 2021, 2:07 a.m. | OK | GNU C++11 | TESTS | 101 | 592 | 15257600 | 2500 | |
116871789 | 1443356159 | E | May 21, 2021, 3:16 a.m. | OK | GNU C++11 | TESTS | 101 | 1107 | 1536000 | 2500 | |
116869370 | renshubing | E | May 21, 2021, 2:28 a.m. | OK | GNU C++11 | TESTS | 101 | 1107 | 2867200 | 2500 | |
116874220 | KurisuMakise | E | May 21, 2021, 3:56 a.m. | OK | GNU C++11 | TESTS | 101 | 1153 | 29491200 | 2500 | |
116878346 | FrozenGuardian3 | E | May 21, 2021, 4:57 a.m. | OK | GNU C++11 | TESTS | 101 | 1170 | 3072000 | 2500 | |
116868632 | sdlwsl | E | May 21, 2021, 2:13 a.m. | OK | GNU C++11 | TESTS | 101 | 1185 | 4505600 | 2500 | |
116874205 | KurisuMakise | E | May 21, 2021, 3:56 a.m. | OK | GNU C++11 | TESTS | 101 | 1185 | 29491200 | 2500 | |
116868623 | vjudge3 | E | May 21, 2021, 2:13 a.m. | OK | GNU C++11 | TESTS | 101 | 1201 | 4505600 | 2500 | |
116867005 | limpid | E | May 21, 2021, 1:26 a.m. | OK | GNU C++11 | TESTS | 101 | 1497 | 32665600 | 2500 | |
116869850 | dreamoon_love_AA | E | May 21, 2021, 2:38 a.m. | OK | GNU C++14 | TESTS | 101 | 467 | 819200 | 2500 | |
116867468 | nandonathaniel | E | May 21, 2021, 1:42 a.m. | OK | GNU C++14 | TESTS | 101 | 1091 | 51200000 | 2500 | |
116863111 | Sixpathsguy | E | May 20, 2021, 10:39 p.m. | OK | GNU C++14 | TESTS | 101 | 1138 | 54579200 | 2500 | |
116864719 | Bedo_Sayed | E | May 20, 2021, 11:57 p.m. | OK | GNU C++14 | TESTS | 101 | 1154 | 16384000 | 2500 | |
116867371 | amunduzbaev | E | May 21, 2021, 1:38 a.m. | OK | GNU C++14 | TESTS | 101 | 1170 | 36454400 | 2500 | |
116870163 | HynDuf | E | May 21, 2021, 2:45 a.m. | OK | GNU C++14 | TESTS | 101 | 1232 | 1740800 | 2500 | |
116850195 | bqq | E | May 20, 2021, 6:13 p.m. | OK | GNU C++14 | TESTS | 101 | 1263 | 52224000 | 2500 | |
116844988 | gege | E | May 20, 2021, 5:33 p.m. | OK | GNU C++14 | TESTS | 101 | 1309 | 1945600 | 2500 | |
116849614 | bqq | E | May 20, 2021, 6:07 p.m. | OK | GNU C++14 | TESTS | 101 | 1543 | 51097600 | 2500 | |
116864525 | SuperJ6 | E | May 20, 2021, 11:47 p.m. | OK | GNU C++14 | TESTS | 101 | 2214 | 225484800 | 2500 | |
116862482 | bfs.07 | E | May 20, 2021, 10:10 p.m. | OK | GNU C++17 | TESTS | 101 | 546 | 2457600 | 2500 | |
116850527 | Resende | E | May 20, 2021, 6:17 p.m. | OK | GNU C++17 | TESTS | 101 | 608 | 819200 | 2500 | |
116882133 | RainAir | E | May 21, 2021, 5:47 a.m. | OK | GNU C++17 | TESTS | 101 | 655 | 1843200 | 2500 | |
116842559 | 1.618 | E | May 20, 2021, 4:34 p.m. | OK | GNU C++17 | TESTS | 101 | 670 | 1126400 | 2500 | |
116856775 | Jaydeep999997 | E | May 20, 2021, 7:45 p.m. | OK | GNU C++17 | TESTS | 101 | 748 | 10444800 | 2500 | |
116865605 | Nanored | E | May 21, 2021, 12:35 a.m. | OK | GNU C++17 | TESTS | 101 | 842 | 1638400 | 2500 | |
116845420 | IsaacMoris | E | May 20, 2021, 5:35 p.m. | OK | GNU C++17 | TESTS | 101 | 967 | 25907200 | 2500 | |
116880492 | wifiiii | E | May 21, 2021, 5:27 a.m. | OK | GNU C++17 | TESTS | 101 | 998 | 1740800 | 2500 | |
116862838 | Rafaelcs | E | May 20, 2021, 10:27 p.m. | OK | GNU C++17 | TESTS | 101 | 1013 | 25190400 | 2500 | |
116851662 | Bugman | E | May 20, 2021, 6:29 p.m. | OK | GNU C++17 | TESTS | 101 | 1138 | 108032000 | 2500 | |
116858484 | rainboy | E | May 20, 2021, 8:19 p.m. | OK | GNU C++17 (64) | TESTS | 101 | 62 | 1331200 | 2500 | |
116867296 | cmwqf | E | May 21, 2021, 1:35 a.m. | OK | GNU C++17 (64) | TESTS | 101 | 514 | 1331200 | 2500 | |
116866916 | qazswedx2 | E | May 21, 2021, 1:23 a.m. | OK | GNU C++17 (64) | TESTS | 101 | 545 | 86937600 | 2500 | |
116858487 | Resende | E | May 20, 2021, 8:19 p.m. | OK | GNU C++17 (64) | TESTS | 101 | 670 | 819200 | 2500 | |
116870494 | Lavine | E | May 21, 2021, 2:52 a.m. | OK | GNU C++17 (64) | TESTS | 101 | 717 | 16588800 | 2500 | |
116850867 | WeakestTopology | E | May 20, 2021, 6:20 p.m. | OK | GNU C++17 (64) | TESTS | 101 | 733 | 1024000 | 2500 | |
116841025 | Heltion | E | May 20, 2021, 4:33 p.m. | OK | GNU C++17 (64) | TESTS | 101 | 779 | 14745600 | 2500 | |
116853082 | edenooo | E | May 20, 2021, 6:47 p.m. | OK | GNU C++17 (64) | TESTS | 101 | 826 | 14745600 | 2500 | |
116873476 | nobodyknow | E | May 21, 2021, 3:44 a.m. | OK | GNU C++17 (64) | TESTS | 101 | 842 | 33280000 | 2500 | |
116870391 | Lavine | E | May 21, 2021, 2:50 a.m. | OK | GNU C++17 (64) | TESTS | 101 | 858 | 16588800 | 2500 | |
116847910 | uwi | E | May 20, 2021, 5:51 p.m. | OK | Java 11 | TESTS | 101 | 1965 | 0 | 2500 | |
116844942 | Tlatoani | E | May 20, 2021, 5:33 p.m. | OK | Kotlin | TESTS | 101 | 1418 | 261427200 | 2500 | |
116845481 | sansen | E | May 20, 2021, 5:35 p.m. | OK | Rust | TESTS | 101 | 1279 | 2867200 | 2500 | |
116845122 | sansen | E | May 20, 2021, 5:34 p.m. | OK | Rust | TESTS | 101 | 1621 | 2560000 | 2500 |
Back to search problems