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"You are given a program that consists of n instructions. Initially a single variable x is assigned to 0 . Afterwards, the instructions are of two types: You are given m queries of the following format: The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. Then the description of t testcases follows. The first line of each testcase contains two integers n and m ( 1 <= n, m <= 2 cdot 10^5 ) -- the number of instructions in the program and the number of queries. The second line of each testcase contains a program -- a string of n characters: each character is either '+' or '-' -- increment and decrement instruction, respectively. Each of the next m lines contains two integers l and r ( 1 <= l <= r <= n ) -- the description of the query. The sum of n over all testcases doesn't exceed 2 cdot 10^5 . The sum of m over all testcases doesn't exceed 2 cdot 10^5 . For each testcase print m integers -- for each query l , r print the number of distinct values variable x is assigned to if all the instructions between the l -th one and the r -th one inclusive are ignored and the rest are executed without changing the order. The instructions that remain for each query of the first testcase are: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
104340084 |
quangngg |
D |
Jan. 14, 2021, 4:23 p.m. |
OK |
FPC |
TESTS |
12 |
639 |
41472000 |
|
|
104347915 |
rainboy |
D |
Jan. 14, 2021, 4:34 p.m. |
OK |
GNU C11 |
TESTS |
12 |
810 |
4198400 |
|
|
104351118 |
CaptainShammer |
D |
Jan. 14, 2021, 4:53 p.m. |
OK |
GNU C11 |
TESTS |
12 |
811 |
5017600 |
|
|
104352787 |
IndexLP |
D |
Jan. 14, 2021, 5:10 p.m. |
OK |
GNU C11 |
TESTS |
12 |
1045 |
17612800 |
|
|
104370696 |
2018LZY |
D |
Jan. 15, 2021, 12:39 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
4198400 |
|
|
104349251 |
fishcathu. |
D |
Jan. 14, 2021, 4:39 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
62 |
4198400 |
|
|
104340747 |
Grice |
D |
Jan. 14, 2021, 4:24 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
93 |
25088000 |
|
|
104371390 |
scarvement |
D |
Jan. 15, 2021, 1:16 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
4198400 |
|
|
104354584 |
lszxj |
D |
Jan. 14, 2021, 5:32 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
4198400 |
|
|
104351317 |
_Zm |
D |
Jan. 14, 2021, 4:55 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
4198400 |
|
|
104340803 |
Shirley_lf |
D |
Jan. 14, 2021, 4:24 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
4198400 |
|
|
104373119 |
yyxh |
D |
Jan. 15, 2021, 2:24 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
4198400 |
|
|
104377704 |
vjudge4 |
D |
Jan. 15, 2021, 4:38 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
4198400 |
|
|
104368981 |
Jsh2201 |
D |
Jan. 14, 2021, 11:17 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
109 |
6348800 |
|
|
104363759 |
AaradhyaSaxena |
D |
Jan. 14, 2021, 8:13 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
124 |
4198400 |
|
|
104350164 |
iamrakeshri28 |
D |
Jan. 14, 2021, 4:45 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
139 |
4198400 |
|
|
104358000 |
hai_koi |
D |
Jan. 14, 2021, 6:21 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
140 |
4198400 |
|
|
104365019 |
aarustark |
D |
Jan. 14, 2021, 8:49 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
140 |
4198400 |
|
|
104373912 |
random_shuffle |
D |
Jan. 15, 2021, 2:51 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
140 |
4198400 |
|
|
104349092 |
_lcarus_ |
D |
Jan. 14, 2021, 4:38 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
140 |
4505600 |
|
|
104344040 |
hgkim |
D |
Jan. 14, 2021, 4:28 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
140 |
5017600 |
|
|
104376285 |
guangguang1 |
D |
Jan. 15, 2021, 4:01 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
140 |
7475200 |
|
|
104355062 |
zayaz777 |
D |
Jan. 14, 2021, 5:39 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
155 |
3993600 |
|
|
104362755 |
Mr_Bing |
D |
Jan. 14, 2021, 7:50 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
155 |
4198400 |
|
|
104368855 |
Uriel |
D |
Jan. 14, 2021, 11:10 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
139 |
4915200 |
|
|
104352119 |
monzaid |
D |
Jan. 14, 2021, 5:03 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
139 |
5017600 |
|
|
104362170 |
AboAbdoMC |
D |
Jan. 14, 2021, 7:37 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
139 |
7168000 |
|
|
104364670 |
Bohun |
D |
Jan. 14, 2021, 8:39 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
140 |
5529600 |
|
|
104375542 |
yzang |
D |
Jan. 15, 2021, 3:41 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
140 |
6144000 |
|
|
104339698 |
wangyu |
D |
Jan. 14, 2021, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
140 |
6656000 |
|
|
104350908 |
ZeldaHuang |
D |
Jan. 14, 2021, 4:51 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
140 |
21094400 |
|
|
104343392 |
Charle |
D |
Jan. 14, 2021, 4:27 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
140 |
21094400 |
|
|
104377512 |
chw0501 |
D |
Jan. 15, 2021, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
155 |
4198400 |
|
|
104375151 |
llx2028 |
D |
Jan. 15, 2021, 3:28 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
155 |
4198400 |
|
|
104373214 |
Terryjoy |
D |
Jan. 15, 2021, 2:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
4198400 |
|
|
104374534 |
m.hasan01 |
D |
Jan. 15, 2021, 3:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
4198400 |
|
|
104358894 |
Thallium54 |
D |
Jan. 14, 2021, 6:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
4812800 |
|
|
104338991 |
ars9 |
D |
Jan. 14, 2021, 4:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
5017600 |
|
|
104370842 |
meverynoob |
D |
Jan. 15, 2021, 12:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
5324800 |
|
|
104367064 |
sjay05 |
D |
Jan. 14, 2021, 9:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
5324800 |
|
|
104357802 |
smith_orz |
D |
Jan. 14, 2021, 6:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
109 |
8499200 |
|
|
104352918 |
Continued_Story |
D |
Jan. 14, 2021, 5:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
124 |
3993600 |
|
|
104365320 |
inzamam_inz |
D |
Jan. 14, 2021, 8:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
124 |
4505600 |
|
|
104372620 |
tikul |
D |
Jan. 15, 2021, 2:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
124 |
4505600 |
|
|
104339530 |
Hasker |
D |
Jan. 14, 2021, 4:22 p.m. |
OK |
Haskell |
TESTS |
12 |
872 |
70553600 |
|
|
104354830 |
Sarvjeet619 |
D |
Jan. 14, 2021, 5:36 p.m. |
OK |
Java 11 |
TESTS |
12 |
265 |
0 |
|
|
104353577 |
Is2ac |
D |
Jan. 14, 2021, 5:19 p.m. |
OK |
Java 11 |
TESTS |
12 |
296 |
2048000 |
|
|
104340767 |
Kabir |
D |
Jan. 14, 2021, 4:24 p.m. |
OK |
Java 11 |
TESTS |
12 |
311 |
0 |
|
|
104362531 |
gssakash |
D |
Jan. 14, 2021, 7:44 p.m. |
OK |
Java 11 |
TESTS |
12 |
311 |
0 |
|
|
104353506 |
rohanxyzgg |
D |
Jan. 14, 2021, 5:18 p.m. |
OK |
Java 11 |
TESTS |
12 |
311 |
0 |
|
|
104340144 |
bobib |
D |
Jan. 14, 2021, 4:23 p.m. |
OK |
Java 11 |
TESTS |
12 |
327 |
0 |
|
|
104374725 |
ArguteOnAir |
D |
Jan. 15, 2021, 3:16 a.m. |
OK |
Java 11 |
TESTS |
12 |
327 |
0 |
|
|
104357861 |
Restricted |
D |
Jan. 14, 2021, 6:20 p.m. |
OK |
Java 11 |
TESTS |
12 |
327 |
0 |
|
|
104364792 |
adarsh000321 |
D |
Jan. 14, 2021, 8:42 p.m. |
OK |
Java 11 |
TESTS |
12 |
327 |
17612800 |
|
|
104342419 |
ada000321 |
D |
Jan. 14, 2021, 4:26 p.m. |
OK |
Java 11 |
TESTS |
12 |
327 |
17612800 |
|
|
104362537 |
prem_cse |
D |
Jan. 14, 2021, 7:44 p.m. |
OK |
Java 8 |
TESTS |
12 |
171 |
0 |
|
|
104359015 |
InANutshell |
D |
Jan. 14, 2021, 6:37 p.m. |
OK |
Java 8 |
TESTS |
12 |
218 |
0 |
|
|
104352100 |
Blowy |
D |
Jan. 14, 2021, 5:03 p.m. |
OK |
Java 8 |
TESTS |
12 |
233 |
0 |
|
|
104381085 |
Prakrit18 |
D |
Jan. 15, 2021, 6:01 a.m. |
OK |
Java 8 |
TESTS |
12 |
234 |
0 |
|
|
104340578 |
godxpunk |
D |
Jan. 14, 2021, 4:24 p.m. |
OK |
Java 8 |
TESTS |
12 |
249 |
0 |
|
|
104357254 |
qlf9 |
D |
Jan. 14, 2021, 6:10 p.m. |
OK |
Java 8 |
TESTS |
12 |
249 |
0 |
|
|
104346470 |
Vaibhav_Domadia |
D |
Jan. 14, 2021, 4:31 p.m. |
OK |
Java 8 |
TESTS |
12 |
249 |
0 |
|
|
104339934 |
godxpunk |
D |
Jan. 14, 2021, 4:23 p.m. |
OK |
Java 8 |
TESTS |
12 |
249 |
0 |
|
|
104339754 |
briankim |
D |
Jan. 14, 2021, 4:22 p.m. |
OK |
Java 8 |
TESTS |
12 |
264 |
9011200 |
|
|
104349190 |
kareem3id |
D |
Jan. 14, 2021, 4:39 p.m. |
OK |
Java 8 |
TESTS |
12 |
280 |
4403200 |
|
|
104369390 |
Spheniscine |
D |
Jan. 14, 2021, 11:36 p.m. |
OK |
Kotlin |
TESTS |
12 |
218 |
0 |
|
|
104347885 |
koper |
D |
Jan. 14, 2021, 4:34 p.m. |
OK |
Kotlin |
TESTS |
12 |
1606 |
204800 |
|
|
104343297 |
dddttdCF |
D |
Jan. 14, 2021, 4:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
186 |
5836800 |
|
|
104357768 |
dundae |
D |
Jan. 14, 2021, 6:18 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
187 |
5427200 |
|
|
104345195 |
forest000014 |
D |
Jan. 14, 2021, 4:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
249 |
9011200 |
|
|
104340336 |
youx |
D |
Jan. 14, 2021, 4:24 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
374 |
7577600 |
|
|
104356023 |
minigimbob |
D |
Jan. 14, 2021, 5:52 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
530 |
5632000 |
|
|
104357787 |
getN1ght |
D |
Jan. 14, 2021, 6:18 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
608 |
5632000 |
|
|
104342327 |
jonitox |
D |
Jan. 14, 2021, 4:26 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
685 |
7987200 |
|
|
104339410 |
grey |
D |
Jan. 14, 2021, 4:21 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
1076 |
11878400 |
|
|
104353247 |
EncryptingWolf |
D |
Jan. 14, 2021, 5:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
1153 |
17408000 |
|
|
104346348 |
thrudgelmir |
D |
Jan. 14, 2021, 4:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
1747 |
6348800 |
|
|
104349013 |
orloffm |
D |
Jan. 14, 2021, 4:38 p.m. |
OK |
.NET Core C# |
TESTS |
12 |
156 |
7577600 |
|
|
104355761 |
zile151 |
D |
Jan. 14, 2021, 5:49 p.m. |
OK |
PyPy 2 |
TESTS |
12 |
249 |
14233600 |
|
|
104341924 |
Gaurav1 |
D |
Jan. 14, 2021, 4:26 p.m. |
OK |
PyPy 2 |
TESTS |
12 |
343 |
18534400 |
|
|
104370357 |
albealfa |
D |
Jan. 15, 2021, 12:22 a.m. |
OK |
PyPy 2 |
TESTS |
12 |
436 |
18841600 |
|
|
104355247 |
TheVan |
D |
Jan. 14, 2021, 5:42 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
311 |
23859200 |
|
|
104381063 |
complexroots |
D |
Jan. 15, 2021, 6 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
343 |
21606400 |
|
|
104346304 |
codingbug4sure |
D |
Jan. 14, 2021, 4:30 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
373 |
15360000 |
|
|
104340126 |
vegetable_chicken1234567 |
D |
Jan. 14, 2021, 4:23 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
389 |
22835200 |
|
|
104347643 |
yinuowang |
D |
Jan. 14, 2021, 4:33 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
405 |
37888000 |
|
|
104352778 |
hxu10 |
D |
Jan. 14, 2021, 5:10 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
436 |
16998400 |
|
|
104349946 |
GalaxyRising |
D |
Jan. 14, 2021, 4:44 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
451 |
35020800 |
|
|
104376912 |
wdyk70825 |
D |
Jan. 15, 2021, 4:17 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
530 |
43622400 |
|
|
104370449 |
shivam_hbtu |
D |
Jan. 15, 2021, 12:26 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
561 |
50688000 |
|
|
104367037 |
musdolph |
D |
Jan. 14, 2021, 9:57 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
592 |
11468800 |
|
|
104343274 |
Actias |
D |
Jan. 14, 2021, 4:27 p.m. |
OK |
Python 3 |
TESTS |
12 |
1310 |
14745600 |
|
|
104338890 |
amayapetako |
D |
Jan. 14, 2021, 4:20 p.m. |
OK |
Python 3 |
TESTS |
12 |
1419 |
21811200 |
|
|
104367032 |
musdolph |
D |
Jan. 14, 2021, 9:57 p.m. |
OK |
Python 3 |
TESTS |
12 |
1513 |
9625600 |
|
|
104351518 |
amayapetako |
D |
Jan. 14, 2021, 4:57 p.m. |
OK |
Python 3 |
TESTS |
12 |
1528 |
23347200 |
|
|
104358646 |
sh1194 |
D |
Jan. 14, 2021, 6:31 p.m. |
OK |
Python 3 |
TESTS |
12 |
1591 |
28364800 |
|
|
104358686 |
sh1194 |
D |
Jan. 14, 2021, 6:32 p.m. |
OK |
Python 3 |
TESTS |
12 |
1606 |
28364800 |
|
|
104358552 |
sh1194 |
D |
Jan. 14, 2021, 6:30 p.m. |
OK |
Python 3 |
TESTS |
12 |
1621 |
28364800 |
|
|
104352878 |
hxu10 |
D |
Jan. 14, 2021, 5:11 p.m. |
OK |
Python 3 |
TESTS |
12 |
1715 |
17408000 |
|
|
104354425 |
pakshi_141199 |
D |
Jan. 14, 2021, 5:30 p.m. |
OK |
Python 3 |
TESTS |
12 |
1793 |
36044800 |
|
|
remove filters
Back to search problems