Codeforces Round 538 (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
1114 Codeforces Round 538 (Div. 2) FINISHED False 7200 182015699 Feb. 10, 2019, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6849 ) D Flood Fill PROGRAMMING dp 1900

B'You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i -th square initially has the color c_i . Let 's say, that two squares i and j belong to the same connected component if c_i = c_j , and c_i = c_k for all k satisfying i < k < j . In other words, all squares on the segment from i to j should have the same color. For example, the line [3, 3, 3] has 1 connected component, while the line [5, 2, 4, 4] has 3 connected components. The game "flood fill" is played on the given line as follows: Find the minimum number of turns needed for the entire line to be changed into a single color. The first line contains a single integer n ( 1 <= n <= 5000 ) -- the number of squares. The second line contains integers c_1, c_2, ldots, c_n ( 1 <= c_i <= 5000 ) -- the initial colors of the squares. Print a single integer -- the minimum number of the turns needed. In the first example, a possible way to achieve an optimal answer is to pick square with index 2 as the starting square and then play as follows: In the second example, a possible way to achieve an optimal answer is to pick square with index 5 as the starting square and then perform recoloring into colors 2, 3, 5, 4 in that order. In the third example, the line already consists of one color only. '...

Tutorials

Codeforces Round #538 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
53659981 Fan_Of_The_Secret_Annex D May 2, 2019, 7:10 a.m. OK Clang++17 Diagnostics TESTS 79 1123 200908800 1900
62446745 rr_ D Oct. 13, 2019, 12:13 a.m. OK D TESTS 79 202 122163200 1900
50647071 Mint_Dentifrice D March 1, 2019, 4:06 p.m. OK FPC TESTS 79 109 100249600 1900
58249407 pnt2k2 D Aug. 4, 2019, 7:08 a.m. OK FPC TESTS 79 124 100761600 1900
49834948 AHTOH._. D Feb. 12, 2019, 3:41 p.m. OK FPC TESTS 79 139 100352000 1900
59662934 luogu_bot1 D Aug. 29, 2019, 1:10 p.m. OK FPC TESTS 79 187 200908800 1900
50345615 chaorenhaha D Feb. 23, 2019, 6:10 a.m. OK FPC TESTS 79 358 200396800 1900
49753132 sansen D Feb. 11, 2019, 4:20 a.m. OK GNU C11 TESTS 79 77 100249600 1900
64514627 jr_john D Nov. 8, 2019, 10:14 a.m. OK GNU C11 TESTS 79 108 200908800 1900
50279667 jason53415 D Feb. 21, 2019, 12:06 p.m. OK GNU C11 TESTS 79 109 100044800 1900
50787932 how2hack D March 4, 2019, 2:13 p.m. OK GNU C11 TESTS 79 109 100556800 1900
58099729 Sarica D July 31, 2019, 11:13 p.m. OK GNU C11 TESTS 79 124 104243200 1900
58077677 Sarica D July 31, 2019, 12:54 p.m. OK GNU C11 TESTS 79 124 104448000 1900
64515487 codelixir D Nov. 8, 2019, 10:33 a.m. OK GNU C11 TESTS 79 139 100556800 1900
58099750 Sarica D July 31, 2019, 11:15 p.m. OK GNU C11 TESTS 79 155 104550400 1900
58970785 naro_ttam D Aug. 17, 2019, 8:16 p.m. OK GNU C11 TESTS 79 171 100864000 1900
65675175 AurumnPegasus D Nov. 24, 2019, 5:39 p.m. OK GNU C11 TESTS 79 202 100659200 1900
51334840 LittleBeetle D March 15, 2019, 1:43 p.m. OK GNU C++11 TESTS 79 31 0 1900
49820792 fsps60312 D Feb. 12, 2019, 8:45 a.m. OK GNU C++11 TESTS 79 46 102400 1900
53283550 chenxiaoyan D April 25, 2019, 12:59 p.m. OK GNU C++11 TESTS 79 46 100249600 1900
49763131 stal_xy23z7b8 D Feb. 11, 2019, 10:09 a.m. OK GNU C++11 TESTS 79 46 100454400 1900
51580343 Strive-for-excellence D March 20, 2019, 2:16 p.m. OK GNU C++11 TESTS 79 46 100659200 1900
59579125 ektrojohn D Aug. 27, 2019, 3:16 p.m. OK GNU C++11 TESTS 79 61 100249600 1900
49978379 2013300262 D Feb. 16, 2019, 7:08 a.m. OK GNU C++11 TESTS 79 61 100454400 1900
49910559 RabbitHu D Feb. 14, 2019, 1:57 p.m. OK GNU C++11 TESTS 79 61 100454400 1900
58177398 xChannel D Aug. 2, 2019, 1:38 p.m. OK GNU C++11 TESTS 79 61 100454400 1900
52810550 ahcl7 D April 16, 2019, 8:21 a.m. OK GNU C++11 TESTS 79 61 100659200 1900
49818868 cristian1997 D Feb. 12, 2019, 7:38 a.m. OK GNU C++14 TESTS 79 46 102400 1900
49767889 knshnb D Feb. 11, 2019, 12:28 p.m. OK GNU C++14 TESTS 79 61 102400 1900
49891041 NiroBC D Feb. 14, 2019, 3:39 a.m. OK GNU C++14 TESTS 79 61 100249600 1900
49764985 1640616850 D Feb. 11, 2019, 11:14 a.m. OK GNU C++14 TESTS 79 61 200806400 1900
67870027 lelouvincx D Dec. 29, 2019, 11:06 a.m. OK GNU C++14 TESTS 79 62 100249600 1900
49884537 CodigoL D Feb. 13, 2019, 8:14 p.m. OK GNU C++14 TESTS 79 62 100249600 1900
49765037 1640616850 D Feb. 11, 2019, 11:15 a.m. OK GNU C++14 TESTS 79 62 100454400 1900
50271195 sewage D Feb. 21, 2019, 7:22 a.m. OK GNU C++14 TESTS 79 62 100454400 1900
50114693 sagar2405 D Feb. 18, 2019, 4:11 p.m. OK GNU C++14 TESTS 79 62 100454400 1900
49832949 AndreiCotor D Feb. 12, 2019, 2:46 p.m. OK GNU C++14 TESTS 79 62 100454400 1900
49969881 lys1280023 D Feb. 16, 2019, 12:52 a.m. OK GNU C++17 TESTS 79 46 102400 1900
50099694 WhiteBeast D Feb. 18, 2019, 2:21 p.m. OK GNU C++17 TESTS 79 46 100249600 1900
50084265 HanaYukii D Feb. 18, 2019, 6:32 a.m. OK GNU C++17 TESTS 79 61 204800 1900
58109151 Thecat D Aug. 1, 2019, 6:14 a.m. OK GNU C++17 TESTS 79 61 100352000 1900
49753043 c0per D Feb. 11, 2019, 4:15 a.m. OK GNU C++17 TESTS 79 61 100556800 1900
53852665 SGHD D May 7, 2019, 2:14 p.m. OK GNU C++17 TESTS 79 62 102400 1900
51601176 Cutelulu D March 21, 2019, 3:58 a.m. OK GNU C++17 TESTS 79 62 100249600 1900
49863264 ivan100sic D Feb. 13, 2019, 10:46 a.m. OK GNU C++17 TESTS 79 62 100454400 1900
49992269 Shayan.P D Feb. 16, 2019, 1:21 p.m. OK GNU C++17 TESTS 79 62 100659200 1900
49998624 stramp D Feb. 16, 2019, 4:17 p.m. OK GNU C++17 TESTS 79 62 100659200 1900
64644590 IslamTalipovTop D Nov. 10, 2019, 2:28 p.m. OK Java 11 TESTS 79 1341 259891200 1900
49854953 Anonymous D Feb. 13, 2019, 6:39 a.m. OK Java 8 TESTS 79 264 145817600 1900
49943353 MadChicken D Feb. 15, 2019, 10:53 a.m. OK Java 8 TESTS 79 264 152473600 1900
49900096 Omar_Morsi D Feb. 14, 2019, 8:54 a.m. OK Java 8 TESTS 79 264 152780800 1900
50481316 mikkk D Feb. 25, 2019, 9:08 a.m. OK Java 8 TESTS 79 265 142643200 1900
51618031 DevilInChina D March 21, 2019, 1:12 p.m. OK Java 8 TESTS 79 280 137830400 1900
50283618 MoeAdel D Feb. 21, 2019, 1:51 p.m. OK Java 8 TESTS 79 280 142745600 1900
49854348 mennafadali D Feb. 13, 2019, 6:18 a.m. OK Java 8 TESTS 79 280 143257600 1900
50123326 ayushchaurasia2879 D Feb. 18, 2019, 4:54 p.m. OK Java 8 TESTS 79 295 145817600 1900
50316911 hongquanntct D Feb. 22, 2019, 12:43 p.m. OK Java 8 TESTS 79 296 142745600 1900
63767782 sakt_coder D Oct. 30, 2019, 6:51 a.m. OK Java 8 TESTS 79 296 143155200 1900
67063225 hibatibati D Dec. 17, 2019, 10:01 a.m. OK Mono C# TESTS 79 218 4300800 1900
49760353 selpo D Feb. 11, 2019, 8:38 a.m. OK Mono C# TESTS 79 249 104550400 1900
49884268 claw88 D Feb. 13, 2019, 8:03 p.m. OK Mono C# TESTS 79 249 104652800 1900
54861215 camypaper D May 31, 2019, 2:07 a.m. OK Mono C# TESTS 79 280 100966400 1900
49885441 claw88 D Feb. 13, 2019, 8:51 p.m. OK Mono C# TESTS 79 280 107212800 1900
57122168 vjudge2 D July 16, 2019, 1:58 a.m. OK MS C++ TESTS 79 77 100659200 1900
57589909 vjudge4 D July 23, 2019, 11:56 a.m. OK MS C++ TESTS 79 108 100352000 1900
58242775 echr D Aug. 4, 2019, 2:48 a.m. OK MS C++ TESTS 79 109 100352000 1900
69284230 vjudge5 D Jan. 22, 2020, 7:25 a.m. OK MS C++ TESTS 79 109 100454400 1900
58856484 vjudge3 D Aug. 15, 2019, 9:31 a.m. OK MS C++ TESTS 79 109 100454400 1900
58259594 echr D Aug. 4, 2019, 11:40 a.m. OK MS C++ TESTS 79 109 100454400 1900
58867629 vjudge3 D Aug. 15, 2019, 2 p.m. OK MS C++ TESTS 79 109 100659200 1900
59674536 vjudge1 D Aug. 29, 2019, 5:32 p.m. OK MS C++ TESTS 79 124 100454400 1900
50094134 Liquor2020 D Feb. 18, 2019, 11:55 a.m. OK MS C++ TESTS 79 124 100659200 1900
58867228 vjudge5 D Aug. 15, 2019, 1:51 p.m. OK MS C++ TESTS 79 124 102195200 1900
49760364 kobebryan9 D Feb. 11, 2019, 8:38 a.m. OK MS C++ 2017 TESTS 79 62 100556800 1900
49867882 tattosha_aptan D Feb. 13, 2019, 12:41 p.m. OK MS C++ 2017 TESTS 79 93 50585600 1900
49900425 kappere D Feb. 14, 2019, 9:03 a.m. OK MS C++ 2017 TESTS 79 109 100249600 1900
64045909 vjudge4 D Nov. 1, 2019, 7:25 p.m. OK MS C++ 2017 TESTS 79 109 100659200 1900
64046046 vjudge1 D Nov. 1, 2019, 7:28 p.m. OK MS C++ 2017 TESTS 79 109 100659200 1900
68237734 CygneNoir D Jan. 5, 2020, 11:37 a.m. OK MS C++ 2017 TESTS 79 109 201216000 1900
49910779 szechuan_sauce D Feb. 14, 2019, 2:03 p.m. OK MS C++ 2017 TESTS 79 124 100556800 1900
68238236 CygneNoir D Jan. 5, 2020, 11:49 a.m. OK MS C++ 2017 TESTS 79 124 201113600 1900
49782159 DavitMarg D Feb. 11, 2019, 5:59 p.m. OK MS C++ 2017 TESTS 79 171 100556800 1900
57637591 vjudge3 D July 24, 2019, 11:24 a.m. OK MS C++ 2017 TESTS 79 202 200806400 1900
57597862 bcollet D July 23, 2019, 2:37 p.m. OK PyPy 2 TESTS 79 295 4505600 1900
49763495 gatsko D Feb. 11, 2019, 10:23 a.m. OK PyPy 2 TESTS 79 374 10956800 1900
49838341 c1729 D Feb. 12, 2019, 5:11 p.m. OK PyPy 2 TESTS 79 576 101273600 1900
49838412 c1729 D Feb. 12, 2019, 5:13 p.m. OK PyPy 2 TESTS 79 577 101273600 1900
49907603 YESMAths D Feb. 14, 2019, 12:44 p.m. OK PyPy 2 TESTS 79 654 101580800 1900
50530413 eightants D Feb. 26, 2019, 1:25 p.m. OK PyPy 2 TESTS 79 951 108953600 1900
49923885 c1729 D Feb. 14, 2019, 8:47 p.m. OK PyPy 2 TESTS 79 1730 203161600 1900
49839769 c1729 D Feb. 12, 2019, 5:49 p.m. OK PyPy 2 TESTS 79 1918 203366400 1900
49950814 Aggr3ssor D Feb. 15, 2019, 1:56 p.m. OK PyPy 3 TESTS 79 326 9728000 1900
49762592 pineriver D Feb. 11, 2019, 9:49 a.m. OK PyPy 3 TESTS 79 327 50995200 1900
49825345 KanhuKeNanu D Feb. 12, 2019, 11:16 a.m. OK PyPy 3 TESTS 79 342 9830400 1900
66478497 BINAVoclock D Dec. 7, 2019, 10:57 p.m. OK PyPy 3 TESTS 79 343 11776000 1900
53992052 vjudge5 D May 11, 2019, 12:45 p.m. OK PyPy 3 TESTS 79 374 9830400 1900
50255502 qLethon D Feb. 20, 2019, 7:27 p.m. OK PyPy 3 TESTS 79 451 1228800 1900
65571128 vjudge2 D Nov. 23, 2019, 7:53 a.m. OK PyPy 3 TESTS 79 467 102400000 1900
50255191 qLethon D Feb. 20, 2019, 7:16 p.m. OK PyPy 3 TESTS 79 514 101376000 1900
49838428 c1729 D Feb. 12, 2019, 5:13 p.m. OK PyPy 3 TESTS 79 530 101580800 1900
68351203 UTMoonlight D Jan. 7, 2020, 9:56 a.m. OK PyPy 3 TESTS 79 561 113459200 1900
49976675 Chenyao D Feb. 16, 2019, 6:20 a.m. OK Rust TESTS 79 139 100761600 1900
49778688 arzk D Feb. 11, 2019, 4:36 p.m. OK Rust TESTS 79 140 100556800 1900
49834829 arzk D Feb. 12, 2019, 3:38 p.m. OK Rust TESTS 79 249 100352000 1900

remove filters

Back to search problems