Codeforces Round 779 (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
1658 Codeforces Round 779 (Div. 2) FINISHED False 7200 83431499 March 27, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 773 ) F Juju and Binary String PROGRAMMING brute force constructive algorithms math

B'The cuteness of a binary string is the number of texttt{1} s divided by the length of the string. For example, the cuteness of texttt{01101} is frac{3}{5} . Juju has a binary string s of length n . She wants to choose some non-intersecting subsegments of s such that their concatenation has length m and it has the same cuteness as the string s . More specifically, she wants to find two arrays l and r of equal length k such that 1 <= q l_1 <= q r_1 < l_2 <= q r_2 < ldots < l_k <= q r_k <= q n , and also: Juju does not like splitting the string into many parts, so she also wants to minimize the value of k . Find the minimum value of k such that there exist l and r that satisfy the constraints above or determine that it is impossible to find such l and r for any k . The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 1 <= q m <= q n <= q 2 cdot 10^5 ). The second line of each test case contains a binary string s of length n . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, if there is no valid pair of l and r , print -1 . Otherwise, print k + 1 lines. In the first line, print a number k ( 1 <= q k <= q m ) -- the minimum number of subsegments required. Then print k lines, the i -th should contain l_i and r_i ( 1 <= q l_i <= q r_i <= q n ) -- the range of the i -th subsegment. Note that you should output the subsegments such that the inequality l_1 <= q r_1 < l_2 <= q r_2 < ldots < l_k <= q r_k is true. In the first example, the cuteness of texttt{0011} is the same as the cuteness of texttt{01} . In the second example, the cuteness of texttt{11000011'...

Tutorials

Codeforces Round #779 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
151161714 rainboy F March 27, 2022, 4:25 p.m. OK GNU C11 TESTS 200 93 204800
151168111 consecutivelimit F March 27, 2022, 5 p.m. OK GNU C++14 TESTS 200 15 204800
151197441 XG0000 F March 28, 2022, 2:43 a.m. OK GNU C++14 TESTS 200 15 1024000
151160992 1353055672 F March 27, 2022, 4:24 p.m. OK GNU C++14 TESTS 200 15 1024000
151193843 SAMSans F March 28, 2022, 12:59 a.m. OK GNU C++14 TESTS 200 30 1843200
151169567 dreamoon_love_AA F March 27, 2022, 5:09 p.m. OK GNU C++14 TESTS 200 30 5222400
151169241 Potassium F March 27, 2022, 5:07 p.m. OK GNU C++14 TESTS 200 31 1843200
151173530 Serva1 F March 27, 2022, 5:46 p.m. OK GNU C++14 TESTS 200 31 1843200
151200943 CharlesWuQiushi F March 28, 2022, 4:04 a.m. OK GNU C++14 TESTS 200 31 2048000
151197547 Raihanulislam12s F March 28, 2022, 2:46 a.m. OK GNU C++14 TESTS 200 31 5017600
151194115 NotaKoala F March 28, 2022, 1:08 a.m. OK GNU C++14 TESTS 200 62 2150400
151181585 Tanjirooo F March 27, 2022, 7:31 p.m. OK GNU C++17 TESTS 200 15 204800
151192857 FHVirus F March 28, 2022, 12:29 a.m. OK GNU C++17 TESTS 200 15 819200
151200702 maoweishou F March 28, 2022, 4 a.m. OK GNU C++17 TESTS 200 15 1843200
151182049 Kochekov F March 27, 2022, 7:39 p.m. OK GNU C++17 TESTS 200 30 1331200
151188951 wxhtzdy F March 27, 2022, 10:12 p.m. OK GNU C++17 TESTS 200 30 1536000
151171286 Moomer F March 27, 2022, 5:23 p.m. OK GNU C++17 TESTS 200 30 4505600
151197095 kaiming_xxy F March 28, 2022, 2:35 a.m. OK GNU C++17 TESTS 200 31 409600
151197010 relyt871 F March 28, 2022, 2:33 a.m. OK GNU C++17 TESTS 200 31 512000
151168718 Marckess F March 27, 2022, 5:04 p.m. OK GNU C++17 TESTS 200 31 1331200
151159550 jurichhh8 F March 27, 2022, 4:21 p.m. OK GNU C++17 TESTS 200 31 1638400
151195010 Kubic F March 28, 2022, 1:36 a.m. OK GNU C++17 (64) TESTS 200 31 1024000
151198347 peiwenjun F March 28, 2022, 3:06 a.m. OK GNU C++17 (64) TESTS 200 31 1024000
151181766 rgnerdplayer F March 27, 2022, 7:35 p.m. OK GNU C++17 (64) TESTS 200 31 1433600
151193145 enslaved F March 28, 2022, 12:37 a.m. OK GNU C++17 (64) TESTS 200 31 1433600
151159521 nuip F March 27, 2022, 4:20 p.m. OK GNU C++17 (64) TESTS 200 31 1433600
151173236 t4m0fey F March 27, 2022, 5:43 p.m. OK GNU C++17 (64) TESTS 200 31 1536000
151168742 zlc1114 F March 27, 2022, 5:04 p.m. OK GNU C++17 (64) TESTS 200 31 9011200
151159798 BreezeMYqwq F March 27, 2022, 4:21 p.m. OK GNU C++17 (64) TESTS 200 31 30924800
151164077 natsugiri F March 27, 2022, 4:30 p.m. OK GNU C++17 (64) TESTS 200 46 204800
151168851 Yunlong_Li F March 27, 2022, 5:04 p.m. OK GNU C++17 (64) TESTS 200 77 2355200
151180774 Bench0310 F March 27, 2022, 7:18 p.m. OK GNU C++20 (64) TESTS 200 15 1331200
151197871 sky123 F March 28, 2022, 2:54 a.m. OK GNU C++20 (64) TESTS 200 15 1536000
151163105 prvocislo F March 27, 2022, 4:28 p.m. OK GNU C++20 (64) TESTS 200 15 1536000
151199792 eptzd F March 28, 2022, 3:40 a.m. OK GNU C++20 (64) TESTS 200 15 2150400
151198396 yingluosanqian F March 28, 2022, 3:08 a.m. OK GNU C++20 (64) TESTS 200 15 2150400
151193282 yizhiyezi F March 28, 2022, 12:42 a.m. OK GNU C++20 (64) TESTS 200 15 2252800
151173796 nor F March 27, 2022, 5:49 p.m. OK GNU C++20 (64) TESTS 200 15 2662400
151168546 Aidos F March 27, 2022, 5:03 p.m. OK GNU C++20 (64) TESTS 200 15 6656000
151176197 DeadlyPillow F March 27, 2022, 6:16 p.m. OK GNU C++20 (64) TESTS 200 15 8704000
151165607 Koosha_Mv F March 27, 2022, 4:33 p.m. OK GNU C++20 (64) TESTS 200 15 8806400
151188153 LongWalk F March 27, 2022, 9:47 p.m. OK Java 11 TESTS 200 218 0
151188184 LongWalk F March 27, 2022, 9:48 p.m. OK Java 11 TESTS 200 233 0
151165704 knightL F March 27, 2022, 4:33 p.m. OK Java 11 TESTS 200 249 0
151201733 6ziv F March 28, 2022, 4:21 a.m. OK MS C++ 2017 TESTS 200 46 819200
151180249 20161222 F March 27, 2022, 7:11 p.m. OK Python 3 TESTS 200 265 6348800

remove filters

Back to search problems