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.
Problems
B'You are given a binary string s of length n (a string consisting of n characters, and each character is either 0 or 1). Let 's look at s as at a binary representation of some integer, and name that integer as the value of string s . For example, the value of 000 is 0 , the value of 01101 is 13 , "100000" is 32 and so on. You can perform at most k operations on s . Each operation should have one of the two following types: What is the minimum value of s you can achieve by performing at most k operations on s ? The first line contains two integers n and k ( 2 <= n <= 5 cdot 10^5 ; 1 <= k <= n ) -- the length of the string s and the maximum number of operations. The second line contains the string s of length n consisting of characters 0 and/or 1. Additional constraint on the input: s contains at least one 1. Print a single integer -- the minimum value of s you can achieve using no more than k operations. Since the answer may be too large, print it modulo 10^{9} + 7 . Note that you need to minimize the original value, not the remainder. In the first example, one of the optimal strategies is the following: In the second example, one of the optimal strategies is the following: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
247987339 |
rainboy |
F |
Feb. 23, 2024, 5:11 p.m. |
OK |
GNU C11 |
TESTS |
46 |
31 |
8294400 |
|
|
247992934 |
rainboy |
F |
Feb. 23, 2024, 5:47 p.m. |
OK |
GNU C11 |
TESTS |
46 |
46 |
8294400 |
|
|
247986013 |
rainboy |
F |
Feb. 23, 2024, 5:04 p.m. |
OK |
GNU C11 |
TESTS |
46 |
483 |
15769600 |
|
|
247986767 |
ciuim |
F |
Feb. 23, 2024, 5:08 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
93 |
16896000 |
|
|
248043189 |
zc2707 |
F |
Feb. 24, 2024, 4:48 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
155 |
14950400 |
|
|
248025717 |
kalimm |
F |
Feb. 23, 2024, 11:14 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
187 |
29081600 |
|
|
248025763 |
kalimm |
F |
Feb. 23, 2024, 11:15 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
202 |
29081600 |
|
|
248000228 |
clfzs |
F |
Feb. 23, 2024, 6:36 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
202 |
74137600 |
|
|
247996909 |
NewLul |
F |
Feb. 23, 2024, 6:13 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
217 |
13107200 |
|
|
247984647 |
heeew |
F |
Feb. 23, 2024, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
217 |
21606400 |
|
|
248016306 |
arvindr9 |
F |
Feb. 23, 2024, 8:54 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
218 |
17715200 |
|
|
248025908 |
kalimm |
F |
Feb. 23, 2024, 11:18 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
264 |
28057600 |
|
|
248025868 |
kalimm |
F |
Feb. 23, 2024, 11:17 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
373 |
28057600 |
|
|
248033202 |
akauto |
F |
Feb. 24, 2024, 2:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
31 |
20377600 |
|
|
248041558 |
JueFan |
F |
Feb. 24, 2024, 4:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
61 |
34406400 |
|
|
247980304 |
Junz_LJL |
F |
Feb. 23, 2024, 4:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
202 |
16179200 |
|
|
248032330 |
tenkei |
F |
Feb. 24, 2024, 1:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
405 |
61030400 |
|
|
247981161 |
Hisiri |
F |
Feb. 23, 2024, 4:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
530 |
61747200 |
|
|
248038963 |
_chroneZ |
F |
Feb. 24, 2024, 3:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
733 |
23244800 |
|
|
247981100 |
Pyqe |
F |
Feb. 23, 2024, 4:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
2495 |
71475200 |
|
|
247993401 |
kovaxis |
F |
Feb. 23, 2024, 5:50 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
31 |
8806400 |
|
|
248045796 |
fyable |
F |
Feb. 24, 2024, 5:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
48 |
46 |
14950400 |
|
|
248040568 |
gqf123 |
F |
Feb. 24, 2024, 4:12 a.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
46 |
21094400 |
|
|
247988338 |
saigumma |
F |
Feb. 23, 2024, 5:17 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
62 |
26419200 |
|
|
248010083 |
dishanth0282 |
F |
Feb. 23, 2024, 7:52 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
62 |
26419200 |
|
|
247991348 |
nskybytskyi |
F |
Feb. 23, 2024, 5:36 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
77 |
13414400 |
|
|
248037953 |
BARBARIANNNNN |
F |
Feb. 24, 2024, 3:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
77 |
23347200 |
|
|
247990985 |
nskybytskyi |
F |
Feb. 23, 2024, 5:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
78 |
13414400 |
|
|
247990151 |
MAKMED1337 |
F |
Feb. 23, 2024, 5:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
109 |
15667200 |
|
|
248030462 |
Wilson_Inversion |
F |
Feb. 24, 2024, 1:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
109 |
23142400 |
|
|
248032839 |
Little_Sheep_Yawn |
F |
Feb. 24, 2024, 1:58 a.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
499 |
72601600 |
|
|
remove filters
Back to search problems