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
Katya recently started to invent programming tasks and prepare her own contests. What she does not like is boring and simple constraints. Katya is fed up with all those " N does not exceed a thousand" and "the sum of a i does not exceed a million" and she decided to come up with something a little more complicated. The last problem written by Katya deals with strings. The input is a string of small Latin letters. To make the statement longer and strike terror into the people who will solve the contest, Katya came up with the following set of k restrictions of the same type (characters in restrictions can be repeated and some restrictions may contradict each other): The number of characters c 1 in a string is not less than l 1 and not more than r 1 . ... The number of characters c i in a string is not less than l i and not more than r i . ... The number of characters c k in a string is not less than l k and not more than r k . However, having decided that it is too simple and obvious, Katya added the following condition: a string meets no less than L and not more than R constraints from the above given list. Katya does not like to compose difficult and mean tests, so she just took a big string s and wants to add to the tests all its substrings that meet the constraints. However, Katya got lost in her conditions and asked you to count the number of substrings of the string s that meet the conditions (each occurrence of the substring is counted separately). The first line contains a non-empty string s , consisting of small Latin letters. The length of the string s does not exceed 10 5 . The second line contains three space-separated integers k , L and R ( 0 ≤ L ≤ R ≤ k ≤ 500 ). Next k lines contain Katya's constrictions in the following form " c i l i r i ". All letters c i are small Latin letters, l i and r i are integers ( 0 ≤ l i ≤ r i ≤ | s | , where | s | is the length of string s ). Letters c i are not necessarily different. Print a single number — the |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
1176868 |
Nikolai |
E |
Feb. 14, 2012, 12:09 p.m. |
OK |
Delphi |
TESTS |
40 |
1050 |
15564800 |
|
2900 |
|
3727575 |
coolinging |
E |
May 16, 2013, 3:39 p.m. |
OK |
FPC |
TESTS |
40 |
1328 |
10956800 |
|
2900 |
|
1310866 |
object022 |
E |
March 8, 2012, 4:18 a.m. |
OK |
FPC |
TESTS |
40 |
1470 |
13516800 |
|
2900 |
|
1014458 |
coolinging |
E |
Jan. 6, 2012, 8:16 a.m. |
OK |
FPC |
TESTS |
40 |
1550 |
11980800 |
|
2900 |
|
1099416 |
zanoes |
E |
Jan. 21, 2012, 3:21 p.m. |
OK |
FPC |
TESTS |
40 |
2690 |
12390400 |
|
2900 |
|
1307961 |
sillycross |
E |
March 7, 2012, 8:35 a.m. |
OK |
FPC |
TESTS |
40 |
2970 |
12697600 |
|
2900 |
|
1414852 |
guille |
E |
March 25, 2012, 5:02 p.m. |
OK |
GNU C++ |
TESTS |
40 |
380 |
3276800 |
|
2900 |
|
4911285 |
xin5739 |
E |
Oct. 27, 2013, 9:52 a.m. |
OK |
GNU C++ |
TESTS |
40 |
546 |
1945600 |
|
2900 |
|
984719 |
UESTC_Nocturne |
E |
Dec. 25, 2011, 6:16 a.m. |
OK |
GNU C++ |
TESTS |
40 |
580 |
22937600 |
|
2900 |
|
8895798 |
davidlee1999WTK |
E |
Nov. 30, 2014, 5:55 a.m. |
OK |
GNU C++ |
TESTS |
40 |
686 |
512000 |
|
2900 |
|
3731819 |
xyjqjb |
E |
May 18, 2013, 1:34 a.m. |
OK |
GNU C++ |
TESTS |
40 |
734 |
512000 |
|
2900 |
|
984866 |
isumi |
E |
Dec. 25, 2011, 7:51 a.m. |
OK |
GNU C++ |
TESTS |
40 |
780 |
2252800 |
|
2900 |
|
2898988 |
perennial_fanatic |
E |
Jan. 9, 2013, 10:39 a.m. |
OK |
GNU C++ |
TESTS |
40 |
812 |
512000 |
|
2900 |
|
1358851 |
ChuckLin2014 |
E |
March 15, 2012, 11:54 a.m. |
OK |
GNU C++ |
TESTS |
40 |
890 |
12492800 |
|
2900 |
|
7619658 |
wjh720 |
E |
Aug. 29, 2014, 8:48 a.m. |
OK |
GNU C++ |
TESTS |
40 |
966 |
11161600 |
|
2900 |
|
987175 |
ryanaaa |
E |
Dec. 26, 2011, 2:43 p.m. |
OK |
GNU C++ |
TESTS |
40 |
1000 |
1945600 |
|
2900 |
|
1045517 |
stan |
E |
Jan. 14, 2012, 4:20 p.m. |
OK |
GNU C++0x |
TESTS |
40 |
1280 |
1945600 |
|
2900 |
|
8996766 |
equation314 |
E |
Dec. 6, 2014, 5:23 a.m. |
OK |
GNU C++0x |
TESTS |
40 |
2276 |
12902400 |
|
2900 |
|
52933015 |
xielinhan |
E |
April 18, 2019, 4:10 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
624 |
12288000 |
|
2900 |
|
30487130 |
lxlxl |
E |
Sept. 19, 2017, 3 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
686 |
12288000 |
|
2900 |
|
15285938 |
newbeginBKB |
E |
Jan. 11, 2016, 9:29 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1740800 |
|
2900 |
|
15285921 |
vjudge1 |
E |
Jan. 11, 2016, 9:26 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1740800 |
|
2900 |
|
15285871 |
vjudge3 |
E |
Jan. 11, 2016, 9:20 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1740800 |
|
2900 |
|
15285567 |
vjudge5 |
E |
Jan. 11, 2016, 8:46 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1740800 |
|
2900 |
|
15285378 |
vjudge3 |
E |
Jan. 11, 2016, 8:21 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1740800 |
|
2900 |
|
15285357 |
vjudge2 |
E |
Jan. 11, 2016, 8:18 a.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1740800 |
|
2900 |
|
49875329 |
theodor.moroianu |
E |
Feb. 13, 2019, 3:36 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
1122 |
1843200 |
|
2900 |
|
45252233 |
KCSC |
E |
Nov. 3, 2018, 5:17 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
1308 |
12902400 |
|
2900 |
|
42842984 |
Cmise |
E |
Sept. 13, 2018, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
1122 |
4710400 |
|
2900 |
|
36393849 |
RayPatterson |
E |
March 18, 2018, 3:22 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
1184 |
14438400 |
|
2900 |
|
56028336 |
sorry_im_smurfing |
E |
June 25, 2019, 8:10 a.m. |
OK |
GNU C++14 |
TESTS |
40 |
1340 |
512000 |
|
2900 |
|
69268330 |
artur.socha |
E |
Jan. 21, 2020, 7:33 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
1340 |
716800 |
|
2900 |
|
23670809 |
Ali.Pi |
E |
Jan. 9, 2017, 8:37 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
1434 |
2457600 |
|
2900 |
|
35559239 |
iqqsoszs |
E |
Feb. 21, 2018, 8:37 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
1434 |
13004800 |
|
2900 |
|
40743467 |
Navick |
E |
July 25, 2018, 1:25 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
1902 |
11161600 |
|
2900 |
|
69683750 |
AlexLuchianov |
E |
Jan. 28, 2020, 4:24 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
1184 |
22835200 |
|
2900 |
|
42240127 |
ruo |
E |
Aug. 29, 2018, 12:04 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
1248 |
716800 |
|
2900 |
|
59229986 |
kefaa2 |
E |
Aug. 21, 2019, 3:05 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
1590 |
11161600 |
|
2900 |
|
56501715 |
Shayan.P |
E |
July 4, 2019, 6:39 a.m. |
OK |
GNU C++17 |
TESTS |
40 |
2244 |
2355200 |
|
2900 |
|
982221 |
YuukaKazami |
E |
Dec. 24, 2011, 2:43 p.m. |
OK |
Java 6 |
TESTS |
40 |
1140 |
43417600 |
|
2900 |
|
3204929 |
aa2985759 |
E |
Feb. 28, 2013, 4:41 a.m. |
OK |
MS C++ |
TESTS |
40 |
468 |
14131200 |
|
2900 |
|
40992031 |
ReaLNero1 |
E |
July 31, 2018, 1:01 a.m. |
OK |
MS C++ |
TESTS |
40 |
560 |
14131200 |
|
2900 |
|
986781 |
zjut_DD |
E |
Dec. 26, 2011, 9:12 a.m. |
OK |
MS C++ |
TESTS |
40 |
1110 |
1945600 |
|
2900 |
|
993048 |
ChaRiL |
E |
Dec. 31, 2011, 12:47 p.m. |
OK |
MS C++ |
TESTS |
40 |
1110 |
3276800 |
|
2900 |
|
993029 |
ChaRiL |
E |
Dec. 31, 2011, 12:30 p.m. |
OK |
MS C++ |
TESTS |
40 |
1170 |
3276800 |
|
2900 |
|
985768 |
-DMYTRO- |
E |
Dec. 25, 2011, 3:28 p.m. |
OK |
MS C++ |
TESTS |
40 |
2550 |
2457600 |
|
2900 |
|
11279986 |
Athee |
E |
May 26, 2015, 2:20 p.m. |
OK |
MS C++ |
TESTS |
40 |
2558 |
10956800 |
|
2900 |
|
986799 |
vitar |
E |
Dec. 26, 2011, 9:26 a.m. |
OK |
MS C++ |
TESTS |
40 |
2780 |
12288000 |
|
2900 |
remove filters
Back to search problems