Codeforces Round 166 (Div. 2)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
271 Codeforces Round 166 (Div. 2) FINISHED False 7200 376583363 Feb. 11, 2013, 3:30 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 11716 ) D Good Substrings PROGRAMMING data structures strings 1800

B'You 've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad. A substring s[l...r] (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89l xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89r xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89|s|) of string s xe2 x80 x89 xe2 x80 x89= xe2 x80 x89 xe2 x80 x89s1s2...s|s| (where |s| is the length of string s) is string xe2 x80 x89slsl xe2 x80 x89+ xe2 x80 x891...sr. The substring s[l...r] is good, if among the letters xe2 x80 x89sl, xe2 x80 x89sl xe2 x80 x89+ xe2 x80 x891, xe2 x80 x89..., xe2 x80 x89sr there are at most k bad ones (look at the sample 's explanation to understand it more clear). Your task is to find the number of distinct good substrings of the given string s. Two substrings s[x...y] and s[p...q] are considered distinct if their content is different, i.e. s[x...y] xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89s[p...q]. The first line of the input is the non-empty string s, consisting of small English letters, the string 's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English letter is good, otherwise it 's bad. That is, the first character of this string corresponds to letter "a", the second one corresponds to letter "b" and so on. The third line of the input consists a single integer k (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89|s|) -- the maximum acceptable number of bad characters in a good substring. Print a single integer -- the number of distinct good substrings of string s. In the first example there are following good substrings: "a", "ab", "b", "ba", "bab". In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".'...

Tutorials

editroal

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
32663690 Jicote D Nov. 26, 2017, 6:55 a.m. OK FPC TESTS 52 92 326656000 1800
56461483 omlgg D July 3, 2019, 7:01 a.m. OK FPC TESTS 52 216 129024000 1800
47844081 HVP.exe D Jan. 2, 2019, 1:44 p.m. OK FPC TESTS 52 248 16384000 1800
28703030 vjudge1 D July 19, 2017, 6:12 p.m. OK GNU C++ TESTS 52 30 25907200 1800
34564929 xht13127 D Jan. 26, 2018, 5:07 a.m. OK GNU C++ TESTS 52 60 20684800 1800
41561051 _no0B D Aug. 13, 2018, 2:15 p.m. OK GNU C++ TESTS 52 62 102400 1800
41561030 vjudge3 D Aug. 13, 2018, 2:14 p.m. OK GNU C++ TESTS 52 62 102400 1800
30879293 _Shakil D Sept. 30, 2017, 6:15 p.m. OK GNU C++ TESTS 52 62 25292800 1800
28685278 vjudge1 D July 19, 2017, 5:38 a.m. OK GNU C++ TESTS 52 62 35942400 1800
30940473 hsk D Oct. 2, 2017, 11:04 a.m. OK GNU C++ TESTS 52 62 224460800 1800
27989262 Altitude D June 23, 2017, 4:49 p.m. OK GNU C++ TESTS 52 92 124928000 1800
27989197 Altitude D June 23, 2017, 4:45 p.m. OK GNU C++ TESTS 52 92 124928000 1800
34543789 samraat1 D Jan. 25, 2018, 11:13 a.m. OK GNU C++ TESTS 52 92 127078400 1800
58676316 rainboy D Aug. 12, 2019, 4:41 p.m. OK GNU C11 TESTS 52 92 9011200 1800
61608729 LHamster D Oct. 1, 2019, 1:29 p.m. OK GNU C11 TESTS 52 278 144486400 1800
27348878 kartik_anand D May 26, 2017, 5:14 a.m. OK GNU C++11 TESTS 52 30 1228800 1800
29481933 gebro83 D Aug. 15, 2017, 12:59 p.m. OK GNU C++11 TESTS 52 30 7680000 1800
29481715 gebro83 D Aug. 15, 2017, 12:49 p.m. OK GNU C++11 TESTS 52 30 7884800 1800
35464465 ywwyww D Feb. 19, 2018, 7:38 a.m. OK GNU C++11 TESTS 52 30 33075200 1800
27688071 Cache D June 9, 2017, 11:36 a.m. OK GNU C++11 TESTS 52 30 33587200 1800
34974315 fpfilko D Feb. 6, 2018, 2:51 p.m. OK GNU C++11 TESTS 52 60 2048000 1800
59835631 GCCCCCCC D Sept. 1, 2019, 3:46 a.m. OK GNU C++11 TESTS 52 62 0 1800
56020635 DennyQi D June 25, 2019, 2:58 a.m. OK GNU C++11 TESTS 52 62 0 1800
52547688 chc_1234567890 D April 9, 2019, 11:38 p.m. OK GNU C++11 TESTS 52 62 0 1800
52547633 vjudge2 D April 9, 2019, 11:32 p.m. OK GNU C++11 TESTS 52 62 0 1800
34605662 satvik007 D Jan. 27, 2018, 12:39 p.m. OK GNU C++14 TESTS 52 30 1945600 1800
28165052 escepta D June 30, 2017, 6:14 a.m. OK GNU C++14 TESTS 52 30 1945600 1800
35064893 Simon7426 D Feb. 8, 2018, 3:58 p.m. OK GNU C++14 TESTS 52 30 5632000 1800
29450658 Restinpeace D Aug. 14, 2017, 7 a.m. OK GNU C++14 TESTS 52 30 6553600 1800
52667716 vjudge4 D April 13, 2019, 5:45 a.m. OK GNU C++14 TESTS 52 60 2969600 1800
65828458 MYNAMEISSHARIFUL D Nov. 27, 2019, 1:27 p.m. OK GNU C++14 TESTS 52 62 0 1800
61567402 Inder007 D Sept. 30, 2019, 5:31 p.m. OK GNU C++14 TESTS 52 62 0 1800
56169647 paulox501 D June 27, 2019, 3:53 p.m. OK GNU C++14 TESTS 52 62 102400 1800
56169645 pmAdriana D June 27, 2019, 3:53 p.m. OK GNU C++14 TESTS 52 62 102400 1800
62457730 xvenom99 D Oct. 13, 2019, 7:06 a.m. OK GNU C++14 TESTS 52 62 102400 1800
52664603 _Kkura_ D April 13, 2019, 3:40 a.m. OK GNU C++17 TESTS 52 30 102400 1800
49554275 Atreus D Feb. 7, 2019, 8:34 a.m. OK GNU C++17 TESTS 52 60 307200 1800
52663994 _Kkura_ D April 13, 2019, 3:06 a.m. OK GNU C++17 TESTS 52 62 102400 1800
52664702 _Kkura_ D April 13, 2019, 3:46 a.m. OK GNU C++17 TESTS 52 62 102400 1800
54252709 vjudge1 D May 16, 2019, 6:08 p.m. OK GNU C++17 TESTS 52 62 204800 1800
46241114 4kuanysh D Nov. 26, 2018, 8:02 a.m. OK GNU C++17 TESTS 52 62 204800 1800
46241329 kenesovbt D Nov. 26, 2018, 8:12 a.m. OK GNU C++17 TESTS 52 62 204800 1800
42298790 vjudge4 D Aug. 31, 2018, 6:03 a.m. OK GNU C++17 TESTS 52 62 307200 1800
46248568 Thanos234 D Nov. 26, 2018, 12:54 p.m. OK GNU C++17 TESTS 52 62 614400 1800
65498393 jereyes4 D Nov. 21, 2019, 5:37 p.m. OK GNU C++17 TESTS 52 62 716800 1800
65660258 NGUYEN_THANH_LOI D Nov. 24, 2019, 12:05 p.m. OK Go TESTS 52 498 136499200 1800
53481663 stefan.sakalik D April 28, 2019, 8:39 p.m. OK Go TESTS 52 560 23142400 1800
65660092 NGUYEN_THANH_LOI D Nov. 24, 2019, 12:01 p.m. OK Go TESTS 52 778 136499200 1800
68048731 kashishsingh8700 D Jan. 1, 2020, 5:42 p.m. OK Java 11 TESTS 52 1028 235520000 1800
66419923 nva D Dec. 6, 2019, 6:28 p.m. OK Java 8 TESTS 52 248 0 1800
32143764 mbfeci D Nov. 8, 2017, 5:53 p.m. OK Java 8 TESTS 52 248 0 1800
31590831 flyman3046 D Oct. 22, 2017, 3:29 a.m. OK Java 8 TESTS 52 248 21094400 1800
39767035 spar5h D June 29, 2018, 11:46 a.m. OK Java 8 TESTS 52 280 0 1800
32733106 tomdmitriev D Nov. 27, 2017, 6:47 p.m. OK Java 8 TESTS 52 280 21196800 1800
58676315 Dukkha D Aug. 12, 2019, 4:41 p.m. OK Java 8 TESTS 52 310 4915200 1800
30978390 illmondo D Oct. 3, 2017, 8:40 p.m. OK Java 8 TESTS 52 342 15769600 1800
30977959 illmondo D Oct. 3, 2017, 8:13 p.m. OK Java 8 TESTS 52 372 32665600 1800
31141121 illmondo D Oct. 8, 2017, 10:47 a.m. OK Java 8 TESTS 52 374 15769600 1800
30979406 illmondo D Oct. 3, 2017, 10:06 p.m. OK Java 8 TESTS 52 404 15769600 1800
59345336 cmplx-xyttmt D Aug. 23, 2019, 9:25 a.m. OK Kotlin TESTS 52 466 102400 1800
64127046 hibatibati D Nov. 3, 2019, 5:20 a.m. OK Mono C# TESTS 52 468 62976000 1800
64126548 hibatibati D Nov. 3, 2019, 5:04 a.m. OK Mono C# TESTS 52 996 68300800 1800
54787604 teru D May 29, 2019, 5:11 a.m. OK Mono C# TESTS 52 1028 90521600 1800
49898873 vjudge4 D Feb. 14, 2019, 8:19 a.m. OK MS C++ TESTS 52 62 102400 1800
40990223 ReaLNero1 D July 30, 2018, 11:43 p.m. OK MS C++ TESTS 52 62 1638400 1800
49898079 vjudge1 D Feb. 14, 2019, 7:56 a.m. OK MS C++ TESTS 52 62 16076800 1800
29632739 Ahmed_Mostafa D Aug. 21, 2017, 1:23 a.m. OK MS C++ TESTS 52 122 234598400 1800
52565215 vjudge2 D April 10, 2019, 12:10 p.m. OK MS C++ TESTS 52 124 242483200 1800
30360001 Volpe D Sept. 15, 2017, 9:11 a.m. OK MS C++ TESTS 52 124 324812800 1800
28696201 vjudge1 D July 19, 2017, 12:28 p.m. OK MS C++ TESTS 52 186 128204800 1800
47866577 tahiatul D Jan. 3, 2019, 10:08 a.m. OK MS C++ TESTS 52 186 135270400 1800
36250131 GMNY D March 13, 2018, 1:23 p.m. OK MS C++ TESTS 52 218 139264000 1800
37696846 Gleb_Dubosarskii D April 28, 2018, 11:47 p.m. OK MS C++ TESTS 52 218 237977600 1800
58512298 CtrlAlt D Aug. 9, 2019, 7:48 p.m. OK MS C++ 2017 TESTS 52 1028 50585600 1800
59367028 duongle1 D Aug. 23, 2019, 5:34 p.m. OK PyPy 2 TESTS 52 340 2252800 1800
46189221 ankit_06 D Nov. 25, 2018, 3:01 a.m. OK PyPy 2 TESTS 52 1090 22732800 1800
66679726 shehebe D Dec. 12, 2019, 12:40 p.m. OK PyPy 2 TESTS 52 1402 11366400 1800
35967313 pavankatta D March 5, 2018, 1:43 p.m. OK PyPy 2 TESTS 52 1684 204390400 1800
59367120 duongle1 D Aug. 23, 2019, 5:36 p.m. OK PyPy 3 TESTS 52 310 3379200 1800
59367162 duongle1 D Aug. 23, 2019, 5:37 p.m. OK PyPy 3 TESTS 52 342 3379200 1800
66254088 ILSM D Dec. 4, 2019, 4:45 a.m. OK PyPy 3 TESTS 52 1778 97075200 1800
68352424 Firepaw D Jan. 7, 2020, 10:31 a.m. OK PyPy 3 TESTS 52 1996 104448000 1800
32532355 nowyyz D Nov. 21, 2017, 5:37 p.m. OK Python 2 TESTS 52 1964 1126400 1800
44574745 TrivialMan D Oct. 20, 2018, 6:33 a.m. OK Python 3 TESTS 52 1590 44134400 1800
63380700 MinecraftFuns D Oct. 25, 2019, 12:23 p.m. OK Python 3 TESTS 52 1808 44441600 1800
35856568 ______u______ D March 2, 2018, 8:22 p.m. OK Ruby TESTS 52 1996 6553600 1800
35856516 ______n______ D March 2, 2018, 8:22 p.m. OK Ruby TESTS 52 1996 6553600 1800
35855986 _____i_____ D March 2, 2018, 8:11 p.m. OK Ruby TESTS 52 1996 6553600 1800
35855711 _____k_____ D March 2, 2018, 8:06 p.m. OK Ruby TESTS 52 1996 6553600 1800
35844588 ______h______ D March 2, 2018, 3:32 p.m. OK Ruby TESTS 52 1996 6553600 1800
35844464 ______k______ D March 2, 2018, 3:30 p.m. OK Ruby TESTS 52 1996 6553600 1800
35844443 ______i______ D March 2, 2018, 3:30 p.m. OK Ruby TESTS 52 1996 6553600 1800
35842261 ______M______ D March 2, 2018, 2:49 p.m. OK Ruby TESTS 52 1996 6553600 1800

remove filters

Back to search problems