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'High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a ' and 'b ' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequence) consisting of equal letters. Vasya can change no more than k characters of the original string. What is the maximum beauty of the string he can achieve? The first line of the input contains two integers n and k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100 xe2 x80 x89000, xe2 x80 x890 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) -- the length of the string and the maximum number of characters to change. The second line contains the string, consisting of letters 'a ' and 'b ' only. Print the only integer -- the maximum beauty of the string Vasya can achieve by changing no more than k characters. In the first sample, Vasya can obtain both strings "aaaa" and "bbbb". In the second sample, the optimal answer is obtained with the string "aaaaabaa" or with the string "aabaaaaa". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
18083839 |
ruban |
C |
May 25, 2016, 4:15 p.m. |
OK |
Delphi |
TESTS |
117 |
31 |
34816000 |
|
1500 |
18083057 |
yan_lazy |
C |
May 25, 2016, 4:08 p.m. |
OK |
FPC |
TESTS |
117 |
15 |
2048000 |
|
1500 |
18088092 |
Shadowest |
C |
May 25, 2016, 4:56 p.m. |
OK |
FPC |
TESTS |
117 |
15 |
2867200 |
|
1500 |
18076508 |
dmlocdmloc |
C |
May 25, 2016, 3:20 p.m. |
OK |
FPC |
TESTS |
117 |
15 |
2867200 |
|
1500 |
18082547 |
Zeron |
C |
May 25, 2016, 4:04 p.m. |
OK |
FPC |
TESTS |
117 |
15 |
3276800 |
|
1500 |
18083532 |
Markellonchik |
C |
May 25, 2016, 4:13 p.m. |
OK |
FPC |
TESTS |
117 |
15 |
4096000 |
|
1500 |
18078341 |
zyding |
C |
May 25, 2016, 3:31 p.m. |
OK |
FPC |
TESTS |
117 |
31 |
2048000 |
|
1500 |
18079814 |
gamo |
C |
May 25, 2016, 3:42 p.m. |
OK |
FPC |
TESTS |
117 |
31 |
2662400 |
|
1500 |
18080079 |
tungtinhoctre126 |
C |
May 25, 2016, 3:44 p.m. |
OK |
FPC |
TESTS |
117 |
31 |
2764800 |
|
1500 |
18083146 |
lerom |
C |
May 25, 2016, 4:09 p.m. |
OK |
FPC |
TESTS |
117 |
31 |
2867200 |
|
1500 |
18078217 |
0lkeh |
C |
May 25, 2016, 3:30 p.m. |
OK |
FPC |
TESTS |
117 |
31 |
3686400 |
|
1500 |
18083973 |
_vikas_ |
C |
May 25, 2016, 4:17 p.m. |
OK |
GNU C |
TESTS |
117 |
30 |
2150400 |
|
1500 |
18086306 |
event_horizon |
C |
May 25, 2016, 4:39 p.m. |
OK |
GNU C |
TESTS |
117 |
30 |
3072000 |
|
1500 |
18080129 |
Chipe1 |
C |
May 25, 2016, 3:44 p.m. |
OK |
GNU C |
TESTS |
117 |
31 |
2150400 |
|
1500 |
18082679 |
xxyyttxx |
C |
May 25, 2016, 4:05 p.m. |
OK |
GNU C |
TESTS |
117 |
31 |
2867200 |
|
1500 |
18085482 |
vietnakid |
C |
May 25, 2016, 4:31 p.m. |
OK |
GNU C |
TESTS |
117 |
31 |
2969600 |
|
1500 |
18080075 |
-NOOB- |
C |
May 25, 2016, 3:44 p.m. |
OK |
GNU C |
TESTS |
117 |
31 |
10035200 |
|
1500 |
18087484 |
niu |
C |
May 25, 2016, 4:50 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2150400 |
|
1500 |
18084063 |
YanHan22 |
C |
May 25, 2016, 4:18 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2150400 |
|
1500 |
18082796 |
Van |
C |
May 25, 2016, 4:06 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2150400 |
|
1500 |
18078218 |
liujunhao |
C |
May 25, 2016, 3:30 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2150400 |
|
1500 |
18077627 |
5_Apm |
C |
May 25, 2016, 3:27 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2150400 |
|
1500 |
18085205 |
saar2119 |
C |
May 25, 2016, 4:29 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18085182 |
Torrance |
C |
May 25, 2016, 4:28 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18082663 |
dayandnight |
C |
May 25, 2016, 4:05 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18081638 |
qzqzzsh |
C |
May 25, 2016, 3:56 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18081582 |
qq1367212627 |
C |
May 25, 2016, 3:56 p.m. |
OK |
GNU C++ |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18077259 |
zoomswk |
C |
May 25, 2016, 3:24 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
1945600 |
|
1500 |
18081002 |
kokkiri29 |
C |
May 25, 2016, 3:51 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2150400 |
|
1500 |
18087808 |
dev.plvlml |
C |
May 25, 2016, 4:53 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18086622 |
angelzouxin |
C |
May 25, 2016, 4:42 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18086026 |
vrobyka |
C |
May 25, 2016, 4:37 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18085875 |
TrungChi |
C |
May 25, 2016, 4:35 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18085152 |
altairashish |
C |
May 25, 2016, 4:28 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18085139 |
1406100039 |
C |
May 25, 2016, 4:28 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18084964 |
minson123 |
C |
May 25, 2016, 4:27 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18084803 |
Branimir |
C |
May 25, 2016, 4:25 p.m. |
OK |
GNU C++11 |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18080817 |
daswas |
C |
May 25, 2016, 3:49 p.m. |
OK |
Go |
TESTS |
117 |
264 |
9216000 |
|
1500 |
18076969 |
mocshare17 |
C |
May 25, 2016, 3:22 p.m. |
OK |
Java 7 |
TESTS |
117 |
124 |
39014400 |
|
1500 |
18084800 |
The_MG |
C |
May 25, 2016, 4:25 p.m. |
OK |
Java 7 |
TESTS |
117 |
124 |
39321600 |
|
1500 |
18083451 |
ankeshgupta007 |
C |
May 25, 2016, 4:12 p.m. |
OK |
Java 7 |
TESTS |
117 |
139 |
39116800 |
|
1500 |
18085286 |
MazzForces |
C |
May 25, 2016, 4:29 p.m. |
OK |
Java 7 |
TESTS |
117 |
139 |
39219200 |
|
1500 |
18078541 |
p1p13 |
C |
May 25, 2016, 3:32 p.m. |
OK |
Java 7 |
TESTS |
117 |
139 |
39424000 |
|
1500 |
18076480 |
fillets |
C |
May 25, 2016, 3:20 p.m. |
OK |
Java 7 |
TESTS |
117 |
140 |
39116800 |
|
1500 |
18085052 |
codder90 |
C |
May 25, 2016, 4:27 p.m. |
OK |
Java 7 |
TESTS |
117 |
155 |
39424000 |
|
1500 |
18084561 |
iakovlev.zakhar |
C |
May 25, 2016, 4:23 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20377600 |
|
1500 |
18082074 |
baobab |
C |
May 25, 2016, 4 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20377600 |
|
1500 |
18077650 |
pho |
C |
May 25, 2016, 3:27 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20377600 |
|
1500 |
18088588 |
webstorms |
C |
May 25, 2016, 5 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20480000 |
|
1500 |
18083166 |
Ahmad_Elsagheer |
C |
May 25, 2016, 4:09 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20480000 |
|
1500 |
18082414 |
korifey |
C |
May 25, 2016, 4:03 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20480000 |
|
1500 |
18085742 |
Corvus |
C |
May 25, 2016, 4:34 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20582400 |
|
1500 |
18081054 |
Sabuwala.Mustafa |
C |
May 25, 2016, 3:51 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20582400 |
|
1500 |
18082161 |
WonderMouse |
C |
May 25, 2016, 4 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20787200 |
|
1500 |
18081969 |
GoodDok |
C |
May 25, 2016, 3:59 p.m. |
OK |
Java 8 |
TESTS |
117 |
124 |
20787200 |
|
1500 |
18084031 |
DigitalArtistKz |
C |
May 25, 2016, 4:17 p.m. |
OK |
MS C# |
TESTS |
117 |
62 |
11878400 |
|
1500 |
18085819 |
m.khooryani |
C |
May 25, 2016, 4:34 p.m. |
OK |
MS C# |
TESTS |
117 |
62 |
13209600 |
|
1500 |
18078239 |
eulerscheZahl |
C |
May 25, 2016, 3:30 p.m. |
OK |
MS C# |
TESTS |
117 |
93 |
13004800 |
|
1500 |
18083704 |
dilshodp |
C |
May 25, 2016, 4:14 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
2355200 |
|
1500 |
18082482 |
Ne0n |
C |
May 25, 2016, 4:03 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
2560000 |
|
1500 |
18084462 |
CS_LYJ1997 |
C |
May 25, 2016, 4:22 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
3174400 |
|
1500 |
18082315 |
x0000ai |
C |
May 25, 2016, 4:02 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
3174400 |
|
1500 |
18079868 |
TheConfessor |
C |
May 25, 2016, 3:42 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
4096000 |
|
1500 |
18089205 |
MsetP |
C |
May 25, 2016, 5:04 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
4198400 |
|
1500 |
18081261 |
rkm0959 |
C |
May 25, 2016, 3:53 p.m. |
OK |
MS C++ |
TESTS |
117 |
15 |
16588800 |
|
1500 |
18080555 |
twangal |
C |
May 25, 2016, 3:47 p.m. |
OK |
MS C++ |
TESTS |
117 |
30 |
2355200 |
|
1500 |
18078973 |
ibrahim_habib |
C |
May 25, 2016, 3:35 p.m. |
OK |
MS C++ |
TESTS |
117 |
30 |
2355200 |
|
1500 |
18079822 |
grandrogue |
C |
May 25, 2016, 3:42 p.m. |
OK |
MS C++ |
TESTS |
117 |
30 |
2560000 |
|
1500 |
18085443 |
Darooha |
C |
May 25, 2016, 4:31 p.m. |
OK |
Ocaml |
TESTS |
117 |
31 |
7884800 |
|
1500 |
18081704 |
naresh7406 |
C |
May 25, 2016, 3:57 p.m. |
OK |
PyPy 2 |
TESTS |
117 |
140 |
25907200 |
|
1500 |
18085340 |
Vosatorp |
C |
May 25, 2016, 4:30 p.m. |
OK |
PyPy 3 |
TESTS |
117 |
202 |
28979200 |
|
1500 |
18083322 |
SerVasilich |
C |
May 25, 2016, 4:11 p.m. |
OK |
PyPy 3 |
TESTS |
117 |
218 |
28160000 |
|
1500 |
18079299 |
WeakChicken |
C |
May 25, 2016, 3:38 p.m. |
OK |
Python 2 |
TESTS |
117 |
109 |
4812800 |
|
1500 |
18084391 |
greendragons |
C |
May 25, 2016, 4:21 p.m. |
OK |
Python 2 |
TESTS |
117 |
155 |
7475200 |
|
1500 |
18079017 |
taoistly |
C |
May 25, 2016, 3:36 p.m. |
OK |
Python 2 |
TESTS |
117 |
217 |
6451200 |
|
1500 |
18085838 |
ppsreejith |
C |
May 25, 2016, 4:35 p.m. |
OK |
Python 2 |
TESTS |
117 |
234 |
6041600 |
|
1500 |
18081715 |
drahton |
C |
May 25, 2016, 3:57 p.m. |
OK |
Python 2 |
TESTS |
117 |
343 |
10137600 |
|
1500 |
18085657 |
osev |
C |
May 25, 2016, 4:33 p.m. |
OK |
Python 2 |
TESTS |
117 |
639 |
4812800 |
|
1500 |
18078543 |
surokpro |
C |
May 25, 2016, 3:32 p.m. |
OK |
Python 3 |
TESTS |
117 |
156 |
5222400 |
|
1500 |
18085555 |
uppi |
C |
May 25, 2016, 4:32 p.m. |
OK |
Python 3 |
TESTS |
117 |
171 |
5222400 |
|
1500 |
18086638 |
Iriskinn |
C |
May 25, 2016, 4:42 p.m. |
OK |
Python 3 |
TESTS |
117 |
218 |
5222400 |
|
1500 |
18082845 |
iSerya |
C |
May 25, 2016, 4:07 p.m. |
OK |
Python 3 |
TESTS |
117 |
218 |
6963200 |
|
1500 |
18081259 |
Utenaq |
C |
May 25, 2016, 3:53 p.m. |
OK |
Python 3 |
TESTS |
117 |
249 |
6041600 |
|
1500 |
18083989 |
Lydone |
C |
May 25, 2016, 4:17 p.m. |
OK |
Python 3 |
TESTS |
117 |
249 |
6963200 |
|
1500 |
18081788 |
wisest |
C |
May 25, 2016, 3:57 p.m. |
OK |
Python 3 |
TESTS |
117 |
265 |
5222400 |
|
1500 |
18084937 |
111vad111 |
C |
May 25, 2016, 4:26 p.m. |
OK |
Python 3 |
TESTS |
117 |
280 |
5222400 |
|
1500 |
18084265 |
UnusedFever |
C |
May 25, 2016, 4:20 p.m. |
OK |
Python 3 |
TESTS |
117 |
296 |
5222400 |
|
1500 |
18080008 |
sparkyyyy |
C |
May 25, 2016, 3:43 p.m. |
OK |
Python 3 |
TESTS |
117 |
343 |
5222400 |
|
1500 |
remove filters
Back to search problems