Codeforces Round 744 (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
1579 Codeforces Round 744 (Div. 3) FINISHED False 8100 104426663 Sept. 28, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4868 ) F Array Stabilization (AND version) PROGRAMMING binary search brute force graphs greedy implementation math number theory shortest paths

B'You are given an array a[0 ldots n - 1] = [a_0, a_1, ldots, a_{n - 1}] of zeroes and ones only. Note that in this problem, unlike the others, the array indexes are numbered from zero, not from one. In one step, the array a is replaced by another array of length n according to the following rules: It means that the whole array a^{ rightarrow d} can be represented as a sequence a^{ rightarrow d} = [a_{n - d}, a_{n - d + 1}, ldots, a_{n - 1}, a_0, a_1, ldots, a_{n - d - 1}] For example, if a = [0, 0, 1, 1] and d = 1 , then a^{ rightarrow d} = [1, 0, 0, 1] and the value of a after the first step will be [0 , & , 1, 0 , & , 0, 1 , & , 0, 1 , & , 1] , that is [0, 0, 0, 1] . The process ends when the array stops changing. For a given array a , determine whether it will consist of only zeros at the end of the process. If yes, also find the number of steps the process will take before it finishes. The first line contains an integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The next 2t lines contain descriptions of the test cases. The first line of each test case description contains two integers: n ( 1 <= n <= 10^6 ) -- array size and d ( 1 <= d <= n ) -- cyclic shift offset. The second line of the description contains n space-separated integers a_i ( 0 <= a_i <= 1 ) -- elements of the array. It is guaranteed that the sum of n over all test cases does not exceed 10^6 . Print t lines, each line containing the answer to the corresponding test case. The answer to a test case should be a single integer -- the number of steps after which the array will contain only zeros for the first time. If there are still elements equal to 1 in the array after the end of the process, print -1. In the third sample test case the array will change as follows: In the fourth sample test case, the arr'...

Tutorials

Codeforces Round #744 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
130285516 ruban F Sept. 29, 2021, 4:21 p.m. OK Delphi TESTS 23 124 99737600
130259646 abhishek32456 F Sept. 29, 2021, 11:48 a.m. OK GNU C11 TESTS 23 187 7680000
130225511 yyyz04 F Sept. 29, 2021, 4:10 a.m. OK GNU C++14 TESTS 23 109 12800000
130286783 Ramprosad F Sept. 29, 2021, 4:37 p.m. OK GNU C++14 TESTS 23 109 16076800
130256586 L.I. F Sept. 29, 2021, 11:14 a.m. OK GNU C++14 TESTS 23 124 12800000
130287254 Ramprosad F Sept. 29, 2021, 4:43 p.m. OK GNU C++14 TESTS 23 124 16076800
130255601 XSamsara F Sept. 29, 2021, 11:03 a.m. OK GNU C++14 TESTS 23 124 16793600
130257013 Tidiane F Sept. 29, 2021, 11:19 a.m. OK GNU C++14 TESTS 23 124 19763200
130245624 wzx_ssl F Sept. 29, 2021, 8:59 a.m. OK GNU C++14 TESTS 23 140 14233600
130263631 capt.popeye F Sept. 29, 2021, 12:31 p.m. OK GNU C++14 TESTS 23 155 12902400
130255946 codycode F Sept. 29, 2021, 11:07 a.m. OK GNU C++14 TESTS 23 155 26521600
130256461 yangxuejian F Sept. 29, 2021, 11:13 a.m. OK GNU C++14 TESTS 23 171 30105600
130254753 no_words_to_sky F Sept. 29, 2021, 10:53 a.m. OK GNU C++17 TESTS 23 46 14336000
130238848 andrewns F Sept. 29, 2021, 7:37 a.m. OK GNU C++17 TESTS 23 77 22323200
130239104 Tak3n F Sept. 29, 2021, 7:40 a.m. OK GNU C++17 TESTS 23 109 11776000
130260229 4524coder F Sept. 29, 2021, 11:54 a.m. OK GNU C++17 TESTS 23 124 4710400
130264368 yukiki02 F Sept. 29, 2021, 12:39 p.m. OK GNU C++17 TESTS 23 124 11776000
130318693 nikhil1_raghav F Sept. 30, 2021, 5:16 a.m. OK GNU C++17 TESTS 23 124 14131200
130280142 cover_drive F Sept. 29, 2021, 3:18 p.m. OK GNU C++17 TESTS 23 140 13107200
130292564 Au_Miner_yyds F Sept. 29, 2021, 5:54 p.m. OK GNU C++17 TESTS 23 140 15769600
130300137 Valkov F Sept. 29, 2021, 7:57 p.m. OK GNU C++17 TESTS 23 155 10649600
130254425 Dhruv_Vavliya F Sept. 29, 2021, 10:49 a.m. OK GNU C++17 TESTS 23 155 12902400
130266288 fk_multi F Sept. 29, 2021, 12:58 p.m. OK GNU C++17 (64) TESTS 23 62 13209600
130270678 qiuzx F Sept. 29, 2021, 1:41 p.m. OK GNU C++17 (64) TESTS 23 93 9318400
130249858 jjjjssss6 F Sept. 29, 2021, 9:52 a.m. OK GNU C++17 (64) TESTS 23 109 13312000
130228027 timothybagas F Sept. 29, 2021, 4:57 a.m. OK GNU C++17 (64) TESTS 23 124 6656000
130237228 duyuxuan0117 F Sept. 29, 2021, 7:17 a.m. OK GNU C++17 (64) TESTS 23 124 12288000
130232679 zwu2019015083 F Sept. 29, 2021, 6:21 a.m. OK GNU C++17 (64) TESTS 23 124 15257600
130292221 ma6755501 F Sept. 29, 2021, 5:49 p.m. OK GNU C++17 (64) TESTS 23 124 15257600
130305241 Iftekhar_Hakim_K F Sept. 29, 2021, 10:14 p.m. OK GNU C++17 (64) TESTS 23 124 24371200
130223057 dqhungdl F Sept. 29, 2021, 3:22 a.m. OK GNU C++17 (64) TESTS 23 139 14643200
130291512 _DaNeK_ F Sept. 29, 2021, 5:40 p.m. OK GNU C++17 (64) TESTS 23 139 16691200
130281002 sharnit F Sept. 29, 2021, 3:28 p.m. OK Java 11 TESTS 23 280 29696000
130264470 akshatj07 F Sept. 29, 2021, 12:40 p.m. OK Java 11 TESTS 23 374 101683200
130225655 RuthlessAggression F Sept. 29, 2021, 4:13 a.m. OK Java 11 TESTS 23 514 78336000
130246474 ruchir28 F Sept. 29, 2021, 9:09 a.m. OK Java 11 TESTS 23 561 54476800
130226494 naman5811 F Sept. 29, 2021, 4:30 a.m. OK Java 11 TESTS 23 561 65945600
130228350 hisenberg01 F Sept. 29, 2021, 5:02 a.m. OK Java 11 TESTS 23 732 67379200
130226241 long2142453426 F Sept. 29, 2021, 4:25 a.m. OK Java 11 TESTS 23 936 24473600
130298941 omar_mohammed F Sept. 29, 2021, 7:32 p.m. OK Java 8 TESTS 23 217 31129600
130251891 naitikvarshney F Sept. 29, 2021, 10:18 a.m. OK Java 8 TESTS 23 233 37580800
130251288 naitikvarshney F Sept. 29, 2021, 10:10 a.m. OK Java 8 TESTS 23 233 37580800
130278135 Sharon F Sept. 29, 2021, 2:56 p.m. OK Java 8 TESTS 23 233 50585600
130284195 invincible777 F Sept. 29, 2021, 4:04 p.m. OK Java 8 TESTS 23 358 58777600
130254159 akshaygupta26 F Sept. 29, 2021, 10:45 a.m. OK Java 8 TESTS 23 670 153190400
130243234 UnHingedFrog F Sept. 29, 2021, 8:31 a.m. OK MS C++ 2017 TESTS 23 530 31436800
130319113 i8nd5t F Sept. 30, 2021, 5:24 a.m. OK PyPy 3 TESTS 23 498 88166400
130288763 guineapig F Sept. 29, 2021, 5:03 p.m. OK PyPy 3 TESTS 23 529 85299200
130234757 vdh_123 F Sept. 29, 2021, 6:48 a.m. OK PyPy 3 TESTS 23 545 79462400
130269464 raidevashish F Sept. 29, 2021, 1:30 p.m. OK PyPy 3 TESTS 23 670 103424000
130291211 Eguy F Sept. 29, 2021, 5:36 p.m. OK PyPy 3 TESTS 23 764 106700800
130291251 Eguy F Sept. 29, 2021, 5:36 p.m. OK PyPy 3 TESTS 23 794 91648000
130223077 JeremyRees F Sept. 29, 2021, 3:22 a.m. OK PyPy 3 TESTS 23 826 90624000
130271532 lemiao12 F Sept. 29, 2021, 1:49 p.m. OK PyPy 3 TESTS 23 889 77824000
130300259 Apass.Jack F Sept. 29, 2021, 7:59 p.m. OK PyPy 3 TESTS 23 966 78336000
130259556 sushmanth.dampur8780 F Sept. 29, 2021, 11:47 a.m. OK Python 3 TESTS 23 826 192819200
130288584 sh1194 F Sept. 29, 2021, 5:01 p.m. OK Python 3 TESTS 23 1169 54374400
130288270 sh1194 F Sept. 29, 2021, 4:56 p.m. OK Python 3 TESTS 23 1201 54374400
130288313 sh1194 F Sept. 29, 2021, 4:57 p.m. OK Python 3 TESTS 23 1216 54374400
130311113 190031512_suhana F Sept. 30, 2021, 2:21 a.m. OK Python 3 TESTS 23 1247 52531200

remove filters

Back to search problems