Codeforces Round 642 (Div. 3)

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
1353 Codeforces Round 642 (Div. 3) FINISHED False 7200 142356299 May 14, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7192 ) E K-periodic Garland PROGRAMMING brute force dp greedy 1900

B'You are given a garland consisting of n lamps. States of the lamps are represented by the string s of length n . The i -th character of the string s_i equals '0 ' if the i -th lamp is turned off or '1 ' if the i -th lamp is turned on. You are also given a positive integer k . In one move, you can choose one lamp and change its state (i.e. turn it on if it is turned off and vice versa). The garland is called k -periodic if the distance between each pair of adjacent turned on lamps is exactly k . Consider the case k=3 . Then garlands "00010010", "1001001", "00010" and "0" are good but garlands "00101001", "1000001" and "01001100" are not. Note that the garland is not cyclic, i.e. the first turned on lamp is not going after the last turned on lamp and vice versa. Your task is to find the minimum number of moves you need to make to obtain k -periodic garland from the given one. You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 25~ 000 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains two integers n and k ( 1 <= n <= 10^6; 1 <= k <= n ) -- the length of s and the required period. The second line of the test case contains the string s consisting of n characters '0 ' and '1 '. It is guaranteed that the sum of n over all test cases does not exceed 10^6 ( sum n <= 10^6 ). For each test case, print the answer -- the minimum number of moves you need to make to obtain k -periodic garland from the given one. '...

Tutorials

Codeforces Round #642 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
81321192 yplusplusplus E May 24, 2020, 5:38 p.m. OK Clang++17 Diagnostics TESTS 43 904 21196800 1900
80155125 Beku.sh E May 14, 2020, 4:39 p.m. OK GNU C11 TESTS 43 109 4915200 1900
80191630 rajatnagar E May 15, 2020, 4:54 a.m. OK GNU C11 TESTS 43 109 4915200 1900
80534196 Frankensten E May 17, 2020, 3:34 p.m. OK GNU C11 TESTS 43 124 12697600 1900
80237268 JoseTomas01 E May 15, 2020, 2:56 p.m. OK GNU C11 TESTS 43 124 21708800 1900
80194644 EngineerLX E May 15, 2020, 5:58 a.m. OK GNU C11 TESTS 43 233 14028800 1900
80690658 lin_rany E May 19, 2020, 1:13 p.m. OK GNU C++11 TESTS 43 31 13312000 1900
80763353 Barret2 E May 20, 2020, 10:35 a.m. OK GNU C++11 TESTS 43 46 1024000 1900
80837930 vjudge3 E May 21, 2020, 9:27 a.m. OK GNU C++11 TESTS 43 46 1024000 1900
80852850 lgwza E May 21, 2020, 12:47 p.m. OK GNU C++11 TESTS 43 46 1024000 1900
80771105 Barret2 E May 20, 2020, 12:16 p.m. OK GNU C++11 TESTS 43 46 1228800 1900
80631266 jimmy-cat E May 18, 2020, 6:25 p.m. OK GNU C++11 TESTS 43 46 2457600 1900
80272479 Ket98 E May 16, 2020, 2:27 a.m. OK GNU C++11 TESTS 43 46 4710400 1900
80183738 hunxuewangzi E May 15, 2020, 1:49 a.m. OK GNU C++11 TESTS 43 46 4710400 1900
80274304 round_0 E May 16, 2020, 3:18 a.m. OK GNU C++11 TESTS 43 46 4915200 1900
80521554 gzl E May 17, 2020, 12:56 p.m. OK GNU C++11 TESTS 43 46 4915200 1900
80387404 fractal E May 16, 2020, 3:28 p.m. OK GNU C++14 TESTS 43 31 17203200 1900
80839744 AaZaDi E May 21, 2020, 9:53 a.m. OK GNU C++14 TESTS 43 46 2560000 1900
80803523 anhad E May 20, 2020, 7:41 p.m. OK GNU C++14 TESTS 43 46 2560000 1900
80716086 mukesh_g7 E May 19, 2020, 6 p.m. OK GNU C++14 TESTS 43 46 2560000 1900
80988205 CSU_WJJJ E May 23, 2020, 6:12 a.m. OK GNU C++14 TESTS 43 46 2560000 1900
81045064 cubeforce777 E May 23, 2020, 7:52 p.m. OK GNU C++14 TESTS 43 46 2560000 1900
81359238 mayank558 E May 25, 2020, 7:43 a.m. OK GNU C++14 TESTS 43 46 2560000 1900
81456438 CoffeeSS E May 26, 2020, 9:38 a.m. OK GNU C++14 TESTS 43 46 2560000 1900
81643602 Bug_You E May 27, 2020, 5:22 p.m. OK GNU C++14 TESTS 43 46 2560000 1900
80544155 nddk E May 17, 2020, 5:50 p.m. OK GNU C++14 TESTS 43 46 4710400 1900
81690281 nofuck E May 28, 2020, 9:25 a.m. OK GNU C++17 TESTS 43 46 1024000 1900
80775057 One_top_two E May 20, 2020, 1:10 p.m. OK GNU C++17 TESTS 43 46 2048000 1900
80693400 rd365 E May 19, 2020, 1:43 p.m. OK GNU C++17 TESTS 43 46 2457600 1900
80673821 rd365 E May 19, 2020, 9:39 a.m. OK GNU C++17 TESTS 43 46 2457600 1900
80811625 Jaxk E May 21, 2020, 12:02 a.m. OK GNU C++17 TESTS 43 46 2560000 1900
81447155 merqurio E May 26, 2020, 7:34 a.m. OK GNU C++17 TESTS 43 46 2560000 1900
81367377 Aur_Batao E May 25, 2020, 9:27 a.m. OK GNU C++17 TESTS 43 46 2560000 1900
81327389 Dr.HumbleFool E May 24, 2020, 7:12 p.m. OK GNU C++17 TESTS 43 46 2560000 1900
81034325 Dr.HumbleFool E May 23, 2020, 5:07 p.m. OK GNU C++17 TESTS 43 46 2560000 1900
80943676 rpcodes E May 22, 2020, 2:43 p.m. OK GNU C++17 TESTS 43 46 2560000 1900
80540817 k0ndr E May 17, 2020, 5:02 p.m. OK GNU C++17 (64) TESTS 43 31 7680000 1900
80164129 raushan303 E May 14, 2020, 6:04 p.m. OK GNU C++17 (64) TESTS 43 31 7680000 1900
80672618 MrBrionix E May 19, 2020, 9:22 a.m. OK GNU C++17 (64) TESTS 43 46 3379200 1900
80641009 ritik_patel05 E May 18, 2020, 9:28 p.m. OK GNU C++17 (64) TESTS 43 46 3379200 1900
80759478 Hasan_Saju E May 20, 2020, 9:43 a.m. OK GNU C++17 (64) TESTS 43 46 3379200 1900
80790771 prottoyfuad E May 20, 2020, 4:28 p.m. OK GNU C++17 (64) TESTS 43 46 3379200 1900
81095271 scoobyDoobyDoo E May 24, 2020, 5:53 a.m. OK GNU C++17 (64) TESTS 43 46 3379200 1900
81025864 AayushAC1998 E May 23, 2020, 3:16 p.m. OK GNU C++17 (64) TESTS 43 46 3993600 1900
80203706 Shaitan_Machine E May 15, 2020, 8:10 a.m. OK GNU C++17 (64) TESTS 43 46 5324800 1900
80155542 m.hasan01 E May 14, 2020, 4:41 p.m. OK GNU C++17 (64) TESTS 43 46 5324800 1900
80197987 synapse E May 15, 2020, 6:47 a.m. OK Go TESTS 43 78 16384000 1900
80965833 retired_ E May 22, 2020, 7:32 p.m. OK Go TESTS 43 78 16691200 1900
80197283 synapse E May 15, 2020, 6:37 a.m. OK Go TESTS 43 78 20684800 1900
80196830 synapse E May 15, 2020, 6:30 a.m. OK Go TESTS 43 93 20684800 1900
80169093 idk321 E May 14, 2020, 7:13 p.m. OK Java 11 TESTS 43 202 23961600 1900
80540872 mikkk E May 17, 2020, 5:02 p.m. OK Java 11 TESTS 43 217 32665600 1900
80164601 Piccadilly E May 14, 2020, 6:10 p.m. OK Java 11 TESTS 43 218 23961600 1900
80170583 Mann_27__ E May 14, 2020, 7:38 p.m. OK Java 11 TESTS 43 218 29388800 1900
80194749 AshrafEzz E May 15, 2020, 5:59 a.m. OK Java 11 TESTS 43 233 23961600 1900
80211589 anhpp E May 15, 2020, 9:52 a.m. OK Java 11 TESTS 43 233 35430400 1900
80271578 mphillotry E May 16, 2020, 1:58 a.m. OK Java 11 TESTS 43 233 44134400 1900
80237155 TheSawan E May 15, 2020, 2:54 p.m. OK Java 11 TESTS 43 234 23961600 1900
80165315 saikaushik333 E May 14, 2020, 6:19 p.m. OK Java 11 TESTS 43 249 24064000 1900
80426182 derrick20 E May 17, 2020, 2:38 a.m. OK Java 11 TESTS 43 249 35430400 1900
81424301 Oopsimbad E May 25, 2020, 10:31 p.m. OK Java 8 TESTS 43 140 18329600 1900
80265242 bluesky111 E May 15, 2020, 9:56 p.m. OK Java 8 TESTS 43 140 20582400 1900
80283405 godxpunk E May 16, 2020, 6:08 a.m. OK Java 8 TESTS 43 140 20684800 1900
80281710 godxpunk E May 16, 2020, 5:41 a.m. OK Java 8 TESTS 43 140 20684800 1900
80245428 kocko E May 15, 2020, 4:36 p.m. OK Java 8 TESTS 43 140 20684800 1900
80227493 Okhair E May 15, 2020, 1:03 p.m. OK Java 8 TESTS 43 140 20684800 1900
80161583 aman28rwt E May 14, 2020, 5:33 p.m. OK Java 8 TESTS 43 140 26112000 1900
80213459 adityakaushik99 E May 15, 2020, 10:16 a.m. OK Java 8 TESTS 43 140 29491200 1900
80193830 PizzaLovers007 E May 15, 2020, 5:46 a.m. OK Java 8 TESTS 43 140 29491200 1900
80224896 manish_98 E May 15, 2020, 12:30 p.m. OK Java 8 TESTS 43 155 20582400 1900
80198678 Spheniscine E May 15, 2020, 6:56 a.m. OK Kotlin TESTS 43 217 37478400 1900
81335952 duckladydinh E May 24, 2020, 10:54 p.m. OK Kotlin TESTS 43 342 4710400 1900
81336026 duckladydinh E May 24, 2020, 10:59 p.m. OK Kotlin TESTS 43 358 4608000 1900
81335863 duckladydinh E May 24, 2020, 10:50 p.m. OK Kotlin TESTS 43 420 11571200 1900
81335812 duckladydinh E May 24, 2020, 10:48 p.m. OK Kotlin TESTS 43 421 5017600 1900
80824994 MadMax E May 21, 2020, 6:23 a.m. OK Kotlin TESTS 43 452 14131200 1900
81335677 duckladydinh E May 24, 2020, 10:42 p.m. OK Kotlin TESTS 43 514 36761600 1900
80157422 songsinger E May 14, 2020, 4:53 p.m. OK Kotlin TESTS 43 529 63283200 1900
80280172 koboshi E May 16, 2020, 5:17 a.m. OK Kotlin TESTS 43 670 186163200 1900
80173175 CepGamer E May 14, 2020, 8:24 p.m. OK Kotlin TESTS 43 920 220160000 1900
80150987 avtoruxadze E May 14, 2020, 4:28 p.m. OK Mono C# TESTS 43 265 29286400 1900
80158846 Halifay E May 14, 2020, 5:05 p.m. OK MS C++ TESTS 43 436 69529600 1900
80232968 vjudge4 E May 15, 2020, 2:06 p.m. OK MS C++ 2017 TESTS 43 46 6144000 1900
80185167 hwqconceptnick E May 15, 2020, 2:36 a.m. OK MS C++ 2017 TESTS 43 46 16793600 1900
80280051 rotoZOOM E May 16, 2020, 5:15 a.m. OK MS C++ 2017 TESTS 43 61 12697600 1900
80934122 vjudge3 E May 22, 2020, 12:36 p.m. OK MS C++ 2017 TESTS 43 62 2560000 1900
80796608 getN1ght E May 20, 2020, 5:49 p.m. OK MS C++ 2017 TESTS 43 77 2662400 1900
80378238 wasd222 E May 16, 2020, 2:24 p.m. OK MS C++ 2017 TESTS 43 78 9728000 1900
80186101 hwqconceptnick E May 15, 2020, 2:56 a.m. OK MS C++ 2017 TESTS 43 140 4710400 1900
80235121 YaMi506 E May 15, 2020, 2:31 p.m. OK MS C++ 2017 TESTS 43 140 6144000 1900
80223738 lijiayi123 E May 15, 2020, 12:17 p.m. OK MS C++ 2017 TESTS 43 140 20787200 1900
81059938 immortalsman E May 24, 2020, 4:30 a.m. OK MS C++ 2017 TESTS 43 155 1024000 1900
80241896 Arturgo E May 15, 2020, 3:50 p.m. OK Ocaml TESTS 43 639 50585600 1900
80610692 pratikjain226 E May 18, 2020, 2:20 p.m. OK PyPy 2 TESTS 43 218 30105600 1900
80242748 sksshivam007 E May 15, 2020, 4:01 p.m. OK PyPy 2 TESTS 43 280 36147200 1900
80888364 chaudhary_19 E May 21, 2020, 9:05 p.m. OK PyPy 2 TESTS 43 296 6758400 1900
80223835 MVP E May 15, 2020, 12:18 p.m. OK PyPy 2 TESTS 43 327 61132800 1900
80189678 mir.panov E May 15, 2020, 4:15 a.m. OK PyPy 2 TESTS 43 358 43110400 1900
80189728 mir.panov E May 15, 2020, 4:16 a.m. OK PyPy 2 TESTS 43 358 43417600 1900
80159358 nishank.suresh E May 14, 2020, 5:10 p.m. OK PyPy 2 TESTS 43 514 38809600 1900
80903090 yumtam E May 22, 2020, 5:19 a.m. OK PyPy 2 TESTS 43 514 63078400 1900
80189557 mir.panov E May 15, 2020, 4:13 a.m. OK PyPy 2 TESTS 43 686 108544000 1900
80158358 nishank.suresh E May 14, 2020, 5:01 p.m. OK PyPy 2 TESTS 43 717 31129600 1900
81430113 rcpc-master E May 26, 2020, 2:22 a.m. OK PyPy 3 TESTS 43 264 11059200 1900
81026919 arijeetghosh251 E May 23, 2020, 3:30 p.m. OK PyPy 3 TESTS 43 280 11059200 1900
80611104 pratikjain226 E May 18, 2020, 2:25 p.m. OK PyPy 3 TESTS 43 280 28569600 1900
80282013 Fullmetal_Algorithmist E May 16, 2020, 5:46 a.m. OK PyPy 3 TESTS 43 295 29696000 1900
80225424 Anuranjan_Pandey E May 15, 2020, 12:37 p.m. OK PyPy 3 TESTS 43 295 31232000 1900
80609299 pratikjain226 E May 18, 2020, 2:03 p.m. OK PyPy 3 TESTS 43 296 30720000 1900
80191566 __eRRor__ E May 15, 2020, 4:53 a.m. OK PyPy 3 TESTS 43 296 94822400 1900
80190849 shiv_99 E May 15, 2020, 4:39 a.m. OK PyPy 3 TESTS 43 311 31129600 1900
80188641 __eRRor__ E May 15, 2020, 3:53 a.m. OK PyPy 3 TESTS 43 312 94617600 1900
80183086 siyy E May 15, 2020, 1:29 a.m. OK PyPy 3 TESTS 43 326 52838400 1900
80610940 pratikjain226 E May 18, 2020, 2:23 p.m. OK Python 2 TESTS 43 686 10035200 1900
80611163 pratikjain226 E May 18, 2020, 2:26 p.m. OK Python 3 TESTS 43 997 10547200 1900
80183046 sansen E May 15, 2020, 1:27 a.m. OK Rust TESTS 43 62 22220800 1900
80164138 macho_uno E May 14, 2020, 6:04 p.m. OK Rust TESTS 43 124 41164800 1900
80152892 cotton100pc E May 14, 2020, 4:32 p.m. OK Rust TESTS 43 171 33894400 1900
80809792 garciparedes E May 20, 2020, 10:36 p.m. OK Rust TESTS 43 311 8396800 1900
81410500 pandrei E May 25, 2020, 6:11 p.m. OK Rust TESTS 43 327 11366400 1900
80243392 bqn E May 15, 2020, 4:09 p.m. OK Rust TESTS 43 639 48128000 1900
80228468 gazaan E May 15, 2020, 1:14 p.m. OK Scala TESTS 43 889 91443200 1900

remove filters

Back to search problems