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
Not so long ago, a certain Timofey learned about docker and now wants to present a report about it at a conference. He has already prepared the text (s). There are (n) people attending the conference. The (i)-th attendee will understand Timofey's report if the number of occurrences of the word " docker " as a contiguous substring in the text is not less than (l_i) and not greater than (r_i). To ensure that as many people as possible learn about docker, Timofey can change characters in his text. Help Timofey determine the minimum number of characters that need to be changed so that the topic is understood by the maximum possible number of attendees. Each test consists of several test cases. The first line contains an integer (t) ((1 \le t \le 10^{4})) — the number of test cases. The description of the test cases follows. The first line of each test case contains one string (s) ((1 \le |s| \le 5 \cdot 10^{5})) — Timofey's text, which consists of lowercase Latin letters. The second line of each test case contains one integer (n) ((1 \le n \le 5 \cdot 10^{5})) — the number of attendees. The next (n) lines of each test case contain two integers (l_{i}, r_{i}) ((1 \le l_{i} \le r_{i} \le 10^{9})). Additional constraints on the input data: The sum of (|s|) across all test cases does not exceed (5 \cdot 10^{5}); The sum of (n) across all test cases does not exceed (5 \cdot 10^{5}). For each test case, print one integer — the minimum number of characters that need to be changed so that the topic is understood by the maximum number of attendees. Let's consider the first test in more detail: in the first test case, it is possible to change all the characters '(x)' at the end of the string to the whole word "(docker)", so that all (3) people will understand the topic; in the second test case, it is possible to change some characters in (s) as follows: "$$$l\color{red}{docker}kd\col |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
330396994 |
_Separation |
F |
July 22, 2025, 4:20 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
328 |
8601600 |
|
|
|
330420460 |
yz114514 |
F |
July 22, 2025, 7:01 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
328 |
12595200 |
|
|
|
330454765 |
XZRSEVEN |
F |
July 23, 2025, 3:53 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
374 |
10547200 |
|
|
|
330450783 |
autumoon |
F |
July 23, 2025, 3:09 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
374 |
33689600 |
|
|
|
330443318 |
Tomato_Cultivator |
F |
July 23, 2025, 1:46 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
405 |
10547200 |
|
|
|
330463763 |
Abhinav_2004 |
F |
July 23, 2025, 5:42 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
421 |
5427200 |
|
|
|
330419878 |
yz114514 |
F |
July 22, 2025, 6:55 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
421 |
12595200 |
|
|
|
330404688 |
LCat90 |
F |
July 22, 2025, 4:45 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
421 |
32153600 |
|
|
|
330415822 |
Noobish_Monk |
F |
July 22, 2025, 6:15 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
436 |
7372800 |
|
|
|
330419258 |
tech_pirates |
F |
July 22, 2025, 6:48 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
436 |
10547200 |
|
|
|
330448401 |
RanRankeainie |
F |
July 23, 2025, 2:44 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
249 |
10547200 |
|
|
|
330429339 |
Khalid_Kamal_ |
F |
July 22, 2025, 9:02 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
280 |
6041600 |
|
|
|
330434975 |
volcano_2025 |
F |
July 22, 2025, 11:14 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
296 |
9420800 |
|
|
|
330406522 |
potatoo |
F |
July 22, 2025, 4:56 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
311 |
10137600 |
|
|
|
330434959 |
volcano_2025 |
F |
July 22, 2025, 11:14 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
312 |
9420800 |
|
|
|
330434935 |
volcano_2025 |
F |
July 22, 2025, 11:13 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
327 |
9420800 |
|
|
|
330439063 |
thisislike_fan |
F |
July 23, 2025, 12:48 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
328 |
7475200 |
|
|
|
330461722 |
eric574 |
F |
July 23, 2025, 5:19 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
343 |
5734400 |
|
|
|
330451048 |
Astatinear |
F |
July 23, 2025, 3:12 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
343 |
40140800 |
|
|
|
330463383 |
MintCat |
F |
July 23, 2025, 5:38 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
358 |
5427200 |
|
|
|
330397293 |
maspy |
F |
July 22, 2025, 4:21 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
233 |
20070400 |
|
|
|
330418572 |
autumoon |
F |
July 22, 2025, 6:41 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
265 |
33792000 |
|
|
|
330464223 |
CP_GOD_9 |
F |
July 23, 2025, 5:47 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
280 |
33792000 |
|
|
|
330453748 |
trp_hy |
F |
July 23, 2025, 3:42 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
281 |
32153600 |
|
|
|
330456260 |
yxfql |
F |
July 23, 2025, 4:12 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
296 |
5529600 |
|
|
|
330407593 |
Syanvu1 |
F |
July 22, 2025, 5:05 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
296 |
9523200 |
|
|
|
330450672 |
qwq___qaq |
F |
July 23, 2025, 3:08 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
296 |
16076800 |
|
|
|
330435242 |
Glitch-20 |
F |
July 22, 2025, 11:24 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
311 |
8499200 |
|
|
|
330465591 |
Scean_Tong |
F |
July 23, 2025, 6:01 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
312 |
6144000 |
|
|
|
330459653 |
A_G |
F |
July 23, 2025, 4:56 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
312 |
7577600 |
|
|
|
330418187 |
Jien |
F |
July 22, 2025, 6:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1624 |
226099200 |
|
|
|
330406595 |
golomb |
F |
July 22, 2025, 4:57 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1624 |
226099200 |
|
|
|
330411586 |
gupta_03 |
F |
July 22, 2025, 5:37 p.m. |
OK |
Rust 2021 |
TESTS |
30 |
156 |
22528000 |
|
|
|
330411087 |
Sugar_fan |
F |
July 22, 2025, 5:33 p.m. |
OK |
Rust 2021 |
TESTS |
30 |
171 |
22528000 |
|
|
|
330416098 |
Ming_Xu |
F |
July 22, 2025, 6:17 p.m. |
OK |
Rust 2021 |
TESTS |
30 |
264 |
20889600 |
|
|
remove filters
Back to search problems