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"Let's call two strings a and b (both of length k ) a bit similar if they have the same character in some position, i. e. there exists at least one i in [1, k] such that a_i = b_i . You are given a binary string s of length n (a string of n characters 0 and/or 1) and an integer k . Let's denote the string s[i..j] as the substring of s starting from the i -th character and ending with the j -th character (that is, s[i..j] = s_i s_{i + 1} s_{i + 2} ... s_{j - 1} s_j ). Let's call a binary string t of length k beautiful if it is a bit similar to all substrings of s having length exactly k ; that is, it is a bit similar to s[1..k], s[2..k+1], ... , s[n-k+1..n] . Your goal is to find the lexicographically smallest string t that is beautiful, or report that no such string exists. String x is lexicographically less than string y if either x is a prefix of y (and x ne y ), or there exists such i ( 1 <= i <= min(|x|, |y|) ), that x_i < y_i , and for any j ( 1 <= j < i ) x_j = y_j . The first line contains one integer q ( 1 <= q <= 10000 ) -- the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers n and k ( 1 <= k <= n <= 10^6 ). The second line contains the string s , consisting of n characters (each character is either 0 or 1). It is guaranteed that the sum of n over all test cases does not exceed 10^6 . For each test case, print the answer as follows: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
102654535 |
fishcathu. |
E |
Dec. 29, 2020, 3:59 a.m. |
OK |
GNU C++11 |
TESTS |
117 |
46 |
1126400 |
|
|
102655488 |
fishcathu. |
E |
Dec. 29, 2020, 4:24 a.m. |
OK |
GNU C++11 |
TESTS |
117 |
46 |
1126400 |
|
|
102655097 |
fishcathu. |
E |
Dec. 29, 2020, 4:14 a.m. |
OK |
GNU C++11 |
TESTS |
117 |
46 |
1126400 |
|
|
102637878 |
fishcathu. |
E |
Dec. 28, 2020, 7:07 p.m. |
OK |
GNU C++11 |
TESTS |
89 |
46 |
1126400 |
|
|
102631724 |
nwi |
E |
Dec. 28, 2020, 5:43 p.m. |
OK |
GNU C++11 |
TESTS |
89 |
46 |
6963200 |
|
|
102652314 |
wsyhb |
E |
Dec. 29, 2020, 2:48 a.m. |
OK |
GNU C++11 |
TESTS |
117 |
46 |
15360000 |
|
|
102627106 |
Hayama_Teru |
E |
Dec. 28, 2020, 4:57 p.m. |
OK |
GNU C++11 |
TESTS |
89 |
62 |
10035200 |
|
|
102629037 |
qwerasdfzxcl |
E |
Dec. 28, 2020, 5:13 p.m. |
OK |
GNU C++11 |
TESTS |
89 |
62 |
76288000 |
|
|
102629404 |
qwerasdfzxcl |
E |
Dec. 28, 2020, 5:16 p.m. |
OK |
GNU C++11 |
TESTS |
89 |
62 |
76288000 |
|
|
102648795 |
star_xingchen_c |
E |
Dec. 29, 2020, 12:18 a.m. |
OK |
GNU C++11 |
TESTS |
117 |
78 |
6144000 |
|
|
102627488 |
dtc03012 |
E |
Dec. 28, 2020, 5 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
46 |
13004800 |
|
|
102660328 |
ISO |
E |
Dec. 29, 2020, 5:57 a.m. |
OK |
GNU C++14 |
TESTS |
117 |
62 |
2048000 |
|
|
102632310 |
apostoldaniel854 |
E |
Dec. 28, 2020, 5:50 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
62 |
3174400 |
|
|
102623431 |
antguz |
E |
Dec. 28, 2020, 4:37 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
62 |
6041600 |
|
|
102649504 |
ijxjdjd |
E |
Dec. 29, 2020, 12:49 a.m. |
OK |
GNU C++14 |
TESTS |
117 |
62 |
6246400 |
|
|
102657209 |
tae826 |
E |
Dec. 29, 2020, 5:03 a.m. |
OK |
GNU C++14 |
TESTS |
117 |
62 |
12083200 |
|
|
102652416 |
Potassium |
E |
Dec. 29, 2020, 2:53 a.m. |
OK |
GNU C++14 |
TESTS |
117 |
77 |
6246400 |
|
|
102629340 |
SuperJ6 |
E |
Dec. 28, 2020, 5:16 p.m. |
OK |
GNU C++14 |
TESTS |
89 |
78 |
5632000 |
|
|
102645965 |
sarthakoherwal |
E |
Dec. 28, 2020, 10:14 p.m. |
OK |
GNU C++14 |
TESTS |
117 |
78 |
7372800 |
|
|
102646396 |
ShubhamAvasthi |
E |
Dec. 28, 2020, 10:30 p.m. |
OK |
GNU C++14 |
TESTS |
117 |
78 |
7987200 |
|
|
102649951 |
blondie |
E |
Dec. 29, 2020, 1:08 a.m. |
OK |
GNU C++17 |
TESTS |
117 |
46 |
16588800 |
|
|
102630724 |
p3rfect |
E |
Dec. 28, 2020, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
61 |
6144000 |
|
|
102650502 |
wgx666 |
E |
Dec. 29, 2020, 1:33 a.m. |
OK |
GNU C++17 |
TESTS |
117 |
62 |
2048000 |
|
|
102624642 |
sempav |
E |
Dec. 28, 2020, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
62 |
5120000 |
|
|
102638694 |
sudoBug |
E |
Dec. 28, 2020, 7:20 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
62 |
8089600 |
|
|
102628795 |
kolina |
E |
Dec. 28, 2020, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
62 |
9113600 |
|
|
102657608 |
CosmicWolf |
E |
Dec. 29, 2020, 5:10 a.m. |
OK |
GNU C++17 |
TESTS |
117 |
62 |
9318400 |
|
|
102644324 |
leofu890806 |
E |
Dec. 28, 2020, 9:23 p.m. |
OK |
GNU C++17 |
TESTS |
117 |
62 |
9420800 |
|
|
102635491 |
yatink2000 |
E |
Dec. 28, 2020, 6:31 p.m. |
OK |
GNU C++17 |
TESTS |
89 |
62 |
15667200 |
|
|
102651818 |
ericxu0 |
E |
Dec. 29, 2020, 2:30 a.m. |
OK |
GNU C++17 |
TESTS |
117 |
62 |
16076800 |
|
|
102646007 |
Thallium_is_Vegetable |
E |
Dec. 28, 2020, 10:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
46 |
3072000 |
|
|
102640186 |
keijak |
E |
Dec. 28, 2020, 7:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
46 |
3072000 |
|
|
102657296 |
YannLiu |
E |
Dec. 29, 2020, 5:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
46 |
5120000 |
|
|
102645500 |
ijkijkijkikjikjkij |
E |
Dec. 28, 2020, 9:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
46 |
7065600 |
|
|
102651591 |
ssyze |
E |
Dec. 29, 2020, 2:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
46 |
20992000 |
|
|
102644918 |
emorgan5289 |
E |
Dec. 28, 2020, 9:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
46 |
21094400 |
|
|
102633778 |
Prateek |
E |
Dec. 28, 2020, 6:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
89 |
61 |
18944000 |
|
|
102644473 |
neal |
E |
Dec. 28, 2020, 9:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
62 |
2048000 |
|
|
102642999 |
KKT_89 |
E |
Dec. 28, 2020, 8:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
62 |
6144000 |
|
|
102657477 |
ramchandra |
E |
Dec. 29, 2020, 5:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
117 |
62 |
6246400 |
|
|
102625115 |
Dukkha |
E |
Dec. 28, 2020, 4:45 p.m. |
OK |
Java 11 |
TESTS |
89 |
311 |
3174400 |
|
|
102638910 |
Madows |
E |
Dec. 28, 2020, 7:24 p.m. |
OK |
Java 11 |
TESTS |
89 |
343 |
5324800 |
|
|
102650257 |
mphillotry |
E |
Dec. 29, 2020, 1:23 a.m. |
OK |
Java 11 |
TESTS |
117 |
514 |
45260800 |
|
|
102659155 |
Oopsimbad |
E |
Dec. 29, 2020, 5:37 a.m. |
OK |
Java 11 |
TESTS |
117 |
561 |
45772800 |
|
|
102658537 |
cwise |
E |
Dec. 29, 2020, 5:27 a.m. |
OK |
Java 8 |
TESTS |
117 |
467 |
223129600 |
|
|
102644815 |
MagentaCobra |
E |
Dec. 28, 2020, 9:36 p.m. |
OK |
Java 8 |
TESTS |
117 |
701 |
44851200 |
|
|
102622609 |
magicrap1 |
E |
Dec. 28, 2020, 4:34 p.m. |
OK |
Java 8 |
TESTS |
89 |
701 |
44851200 |
|
|
102647067 |
robinz62 |
E |
Dec. 28, 2020, 10:56 p.m. |
OK |
Java 8 |
TESTS |
117 |
872 |
83046400 |
|
|
102640582 |
notnamed |
E |
Dec. 28, 2020, 7:54 p.m. |
OK |
Java 8 |
TESTS |
117 |
966 |
38912000 |
|
|
102635476 |
martins |
E |
Dec. 28, 2020, 6:31 p.m. |
OK |
Java 8 |
TESTS |
89 |
982 |
409600 |
|
|
102647775 |
MagentaCobra |
E |
Dec. 28, 2020, 11:27 p.m. |
OK |
Java 8 |
TESTS |
117 |
1138 |
74240000 |
|
|
102656514 |
MagentaCobra |
E |
Dec. 29, 2020, 4:48 a.m. |
OK |
Java 8 |
TESTS |
117 |
1154 |
74240000 |
|
|
102644597 |
MagentaCobra |
E |
Dec. 28, 2020, 9:31 p.m. |
OK |
Java 8 |
TESTS |
117 |
1154 |
74240000 |
|
|
102648873 |
MagentaCobra |
E |
Dec. 29, 2020, 12:21 a.m. |
OK |
Java 8 |
TESTS |
117 |
1170 |
74137600 |
|
|
102644798 |
MagentaCobra |
E |
Dec. 28, 2020, 9:36 p.m. |
OK |
Kotlin |
TESTS |
117 |
592 |
47718400 |
|
|
102650516 |
CepGamer |
E |
Dec. 29, 2020, 1:34 a.m. |
OK |
Kotlin |
TESTS |
117 |
686 |
71577600 |
|
|
102631969 |
Gravekper |
E |
Dec. 28, 2020, 5:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
89 |
467 |
23040000 |
|
|
102626759 |
fancy_lettuce |
E |
Dec. 28, 2020, 4:55 p.m. |
OK |
.NET Core C# |
TESTS |
89 |
155 |
26828800 |
|
|
102627662 |
jimm89 |
E |
Dec. 28, 2020, 5:01 p.m. |
OK |
PyPy 3 |
TESTS |
89 |
327 |
22118400 |
|
|
102628514 |
nehan_der_thal |
E |
Dec. 28, 2020, 5:08 p.m. |
OK |
PyPy 3 |
TESTS |
89 |
327 |
23449600 |
|
|
102628966 |
titia |
E |
Dec. 28, 2020, 5:12 p.m. |
OK |
PyPy 3 |
TESTS |
89 |
420 |
13107200 |
|
|
102645661 |
jimm89 |
E |
Dec. 28, 2020, 10:02 p.m. |
OK |
PyPy 3 |
TESTS |
117 |
498 |
47001600 |
|
|
102652230 |
sh1194 |
E |
Dec. 29, 2020, 2:45 a.m. |
OK |
PyPy 3 |
TESTS |
117 |
748 |
87244800 |
|
|
102652329 |
sh1194 |
E |
Dec. 29, 2020, 2:49 a.m. |
OK |
PyPy 3 |
TESTS |
117 |
795 |
87040000 |
|
|
102637847 |
huikang |
E |
Dec. 28, 2020, 7:06 p.m. |
OK |
PyPy 3 |
TESTS |
89 |
1014 |
34304000 |
|
|
102637963 |
huikang |
E |
Dec. 28, 2020, 7:08 p.m. |
OK |
PyPy 3 |
TESTS |
89 |
1029 |
33792000 |
|
|
102659916 |
Mahipalkeizer |
E |
Dec. 29, 2020, 5:50 a.m. |
OK |
PyPy 3 |
TESTS |
117 |
1076 |
80793600 |
|
|
102648742 |
at_f |
E |
Dec. 29, 2020, 12:15 a.m. |
OK |
PyPy 3 |
TESTS |
117 |
1731 |
171315200 |
|
|
102653515 |
hdnkt |
E |
Dec. 29, 2020, 3:28 a.m. |
OK |
Python 3 |
TESTS |
117 |
1794 |
27545600 |
|
|
102659920 |
sansen |
E |
Dec. 29, 2020, 5:50 a.m. |
OK |
Rust |
TESTS |
117 |
124 |
12390400 |
|
|
remove filters
Back to search problems