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'Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem. Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible. He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work. The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal. Note that the occurrences of string t in s can overlap. Check the third example for clarification. The first line contains string of small Latin letters and question marks s (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89|s| xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). The second line contains string of small Latin letters t (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89|t| xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). Product of lengths of strings |s| xc2 xb7|t| won 't exceed 107. Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters. In the first example the resulting string s is "winlosewinwinlwinwin" In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary. In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
27258835 |
meowoo |
G |
May 21, 2017, 5:06 a.m. |
OK |
D |
TESTS |
69 |
78 |
4198400 |
|
2300 |
32711254 |
AsahiKasugano |
G |
Nov. 27, 2017, 10:08 a.m. |
OK |
FPC |
TESTS |
69 |
46 |
4505600 |
|
2300 |
27313711 |
linkct |
G |
May 24, 2017, 4:08 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1024000 |
|
2300 |
27387160 |
LeslieJRC |
G |
May 27, 2017, 11:52 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1228800 |
|
2300 |
27278846 |
Kvar_ispw17 |
G |
May 22, 2017, 7:28 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1228800 |
|
2300 |
27148572 |
fgvfgfg1 |
G |
May 16, 2017, 2:38 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1228800 |
|
2300 |
27214358 |
cyand1317 |
G |
May 19, 2017, 12:35 p.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1331200 |
|
2300 |
27607727 |
gurkot |
G |
June 6, 2017, 7:37 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1433600 |
|
2300 |
27321630 |
jasonvictoryan |
G |
May 24, 2017, 2:22 p.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1536000 |
|
2300 |
27206594 |
quintessence |
G |
May 19, 2017, 2:27 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1536000 |
|
2300 |
27206583 |
vjudge2 |
G |
May 19, 2017, 2:26 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1536000 |
|
2300 |
42444666 |
Ning_Mew |
G |
Sept. 4, 2018, 1:41 a.m. |
OK |
GNU C++ |
TESTS |
69 |
31 |
1638400 |
|
2300 |
66567488 |
laquendi |
G |
Dec. 10, 2019, 12:21 a.m. |
OK |
GNU C11 |
TESTS |
69 |
187 |
89292800 |
|
2300 |
27196738 |
vjudge3 |
G |
May 18, 2017, 12:47 p.m. |
OK |
GNU C++11 |
TESTS |
69 |
15 |
1843200 |
|
2300 |
34604715 |
shdut |
G |
Jan. 27, 2018, 12:06 p.m. |
OK |
GNU C++11 |
TESTS |
69 |
15 |
3891200 |
|
2300 |
27157850 |
gongy |
G |
May 16, 2017, 11:27 a.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
716800 |
|
2300 |
27274151 |
xyz.abc |
G |
May 21, 2017, 9:52 p.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1024000 |
|
2300 |
65402388 |
sgk |
G |
Nov. 19, 2019, 11:51 p.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1024000 |
|
2300 |
27159188 |
RNS_JKS |
G |
May 16, 2017, 12:27 p.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1126400 |
|
2300 |
47606960 |
luogu_bot1 |
G |
Dec. 28, 2018, 5:52 a.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1228800 |
|
2300 |
27331212 |
RETURNCZQ |
G |
May 25, 2017, 7:27 a.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1228800 |
|
2300 |
27194695 |
jacknazi |
G |
May 18, 2017, 11:03 a.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1228800 |
|
2300 |
57569781 |
Puslim_2 |
G |
July 23, 2019, 4:44 a.m. |
OK |
GNU C++11 |
TESTS |
69 |
31 |
1228800 |
|
2300 |
27226810 |
goldflake |
G |
May 20, 2017, 2:36 a.m. |
OK |
GNU C++14 |
TESTS |
69 |
15 |
1126400 |
|
2300 |
40981473 |
ReaLNero1 |
G |
July 30, 2018, 6 p.m. |
OK |
GNU C++14 |
TESTS |
69 |
30 |
1228800 |
|
2300 |
27184916 |
besher |
G |
May 17, 2017, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
69 |
30 |
1536000 |
|
2300 |
27190431 |
lys1280023 |
G |
May 18, 2017, 5:20 a.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
819200 |
|
2300 |
27660812 |
AmberFrame |
G |
June 8, 2017, 12:59 a.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
1024000 |
|
2300 |
52492060 |
vjudge5 |
G |
April 8, 2019, 12:06 p.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
29821221 |
Acheing |
G |
Aug. 27, 2017, 7:43 a.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
27905808 |
Masquerade- |
G |
June 19, 2017, 1:39 p.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
27905606 |
Masquerade- |
G |
June 19, 2017, 1:29 p.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
27422554 |
zstu_jack |
G |
May 29, 2017, 3:36 a.m. |
OK |
GNU C++14 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
57841969 |
Peasant |
G |
July 27, 2019, 9:38 a.m. |
OK |
GNU C++17 |
TESTS |
69 |
31 |
1228800 |
|
2300 |
50317290 |
vjudge4 |
G |
Feb. 22, 2019, 12:52 p.m. |
OK |
GNU C++17 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
61940195 |
PauloMiranda98 |
G |
Oct. 5, 2019, 7:27 p.m. |
OK |
GNU C++17 |
TESTS |
69 |
31 |
1433600 |
|
2300 |
40976140 |
LaoZei |
G |
July 30, 2018, 3:33 p.m. |
OK |
GNU C++17 |
TESTS |
69 |
31 |
12288000 |
|
2300 |
39462331 |
Andreasyan |
G |
June 21, 2018, 12:43 p.m. |
OK |
GNU C++17 |
TESTS |
69 |
46 |
1024000 |
|
2300 |
69554005 |
antontrygubO_o |
G |
Jan. 26, 2020, 7:54 a.m. |
OK |
GNU C++17 |
TESTS |
69 |
46 |
1126400 |
|
2300 |
56434545 |
Rahul |
G |
July 2, 2019, 1:33 p.m. |
OK |
GNU C++17 |
TESTS |
69 |
46 |
1126400 |
|
2300 |
55079653 |
vjudge1 |
G |
June 4, 2019, 10:11 a.m. |
OK |
GNU C++17 |
TESTS |
69 |
46 |
1433600 |
|
2300 |
61095697 |
Dating |
G |
Sept. 23, 2019, 2:47 a.m. |
OK |
GNU C++17 |
TESTS |
69 |
46 |
1433600 |
|
2300 |
57631129 |
Glamorgan-acmer |
G |
July 24, 2019, 8:47 a.m. |
OK |
GNU C++17 |
TESTS |
69 |
46 |
1433600 |
|
2300 |
56294382 |
junipertest |
G |
June 30, 2019, 4:35 a.m. |
OK |
Java 8 |
TESTS |
69 |
124 |
0 |
|
2300 |
56294398 |
vjudge5 |
G |
June 30, 2019, 4:36 a.m. |
OK |
Java 8 |
TESTS |
69 |
139 |
0 |
|
2300 |
27460259 |
huangzr |
G |
May 31, 2017, 6:23 a.m. |
OK |
Java 8 |
TESTS |
69 |
171 |
0 |
|
2300 |
34489830 |
Azuz |
G |
Jan. 23, 2018, 4:59 p.m. |
OK |
Java 8 |
TESTS |
69 |
374 |
83763200 |
|
2300 |
27161734 |
Kammola |
G |
May 16, 2017, 2:26 p.m. |
OK |
Java 8 |
TESTS |
69 |
451 |
79769600 |
|
2300 |
58839988 |
lpm |
G |
Aug. 15, 2019, 1:21 a.m. |
OK |
Java 8 |
TESTS |
69 |
1184 |
16896000 |
|
2300 |
58843508 |
lpm |
G |
Aug. 15, 2019, 3:35 a.m. |
OK |
Java 8 |
TESTS |
69 |
1185 |
16896000 |
|
2300 |
47813677 |
jenish9599 |
G |
Jan. 1, 2019, 1:01 p.m. |
OK |
Java 8 |
TESTS |
69 |
1715 |
39116800 |
|
2300 |
46694271 |
aminul |
G |
Dec. 6, 2018, 6:28 p.m. |
OK |
Java 8 |
TESTS |
69 |
1747 |
73011200 |
|
2300 |
27214076 |
hazelsive |
G |
May 19, 2017, 12:21 p.m. |
OK |
Java 8 |
TESTS |
69 |
1747 |
73113600 |
|
2300 |
47539237 |
vjudge4 |
G |
Dec. 27, 2018, 5:41 a.m. |
OK |
MS C++ |
TESTS |
69 |
31 |
1433600 |
|
2300 |
47539221 |
vjudge1 |
G |
Dec. 27, 2018, 5:40 a.m. |
OK |
MS C++ |
TESTS |
69 |
31 |
1433600 |
|
2300 |
52590854 |
vjudge1 |
G |
April 11, 2019, 5:30 a.m. |
OK |
MS C++ |
TESTS |
69 |
46 |
1433600 |
|
2300 |
49383186 |
vjudge2 |
G |
Feb. 3, 2019, 4:29 a.m. |
OK |
MS C++ |
TESTS |
69 |
46 |
1433600 |
|
2300 |
52568646 |
vjudge4 |
G |
April 10, 2019, 1:23 p.m. |
OK |
MS C++ |
TESTS |
69 |
46 |
1536000 |
|
2300 |
52573706 |
vjudge4 |
G |
April 10, 2019, 3:21 p.m. |
OK |
MS C++ |
TESTS |
69 |
46 |
2252800 |
|
2300 |
53286190 |
vjudge2 |
G |
April 25, 2019, 1:58 p.m. |
OK |
MS C++ |
TESTS |
69 |
62 |
1433600 |
|
2300 |
49573720 |
vjudge4 |
G |
Feb. 7, 2019, 1:59 p.m. |
OK |
MS C++ |
TESTS |
69 |
389 |
92774400 |
|
2300 |
49610540 |
vjudge3 |
G |
Feb. 7, 2019, 11:43 p.m. |
OK |
MS C++ |
TESTS |
69 |
436 |
53145600 |
|
2300 |
27304380 |
ebworm |
G |
May 23, 2017, 3:34 p.m. |
OK |
MS C++ |
TESTS |
69 |
1653 |
11980800 |
|
2300 |
27164847 |
iynaur87 |
G |
May 16, 2017, 4:19 p.m. |
OK |
PyPy 3 |
TESTS |
69 |
249 |
4710400 |
|
2300 |
66238847 |
iamssk |
G |
Dec. 3, 2019, 5:15 p.m. |
OK |
PyPy 3 |
TESTS |
69 |
358 |
10854400 |
|
2300 |
remove filters
Back to search problems