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'Dmitry has a string s , consisting of lowercase Latin letters. Dmitry decided to remove two consecutive characters from the string s and you are wondering how many different strings can be obtained after such an operation. For example, Dmitry has a string "aaabcc". You can get the following different strings: "abcc"(by deleting the first two or second and third characters), "aacc"(by deleting the third and fourth characters),"aaac"(by deleting the fourth and the fifth character) and "aaab" (by deleting the last two). The first line of input data contains a single integer t ( 1 <= t <= 10^4 ) -- number of test cases. The descriptions of the test cases follow. The first line of the description of each test case contains an integer n ( 3 <= n <= 2 cdot 10^5 ). The second line of the description of each test case contains a string s of length n consisting of lowercase Latin letters. It is guaranteed that the sum of n for all test cases does not exceed 2 cdot 10^5 . For each test case print one integer -- the number of distinct strings that can be obtained by removing two consecutive letters. The first example is explained in the statement. In the third example, the following strings are obtained: "cdef", "adef", "abef", "abcf", "abcd". In the seventh example, any deletion will result in the string "aba". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
195745564 |
mban259 |
D |
March 3, 2023, 1:26 a.m. |
OK |
C# 10 |
TESTS |
12 |
46 |
1126400 |
|
|
195730910 |
kowalski_analysis |
D |
March 2, 2023, 8:25 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
9 |
155 |
13209600 |
|
|
195745561 |
1435730 |
D |
March 3, 2023, 1:26 a.m. |
OK |
GNU C11 |
TESTS |
12 |
31 |
204800 |
|
|
195743940 |
1xx55 |
D |
March 3, 2023, 12:50 a.m. |
OK |
GNU C11 |
TESTS |
12 |
46 |
204800 |
|
|
195753458 |
tan_chao |
D |
March 3, 2023, 4:02 a.m. |
OK |
GNU C11 |
TESTS |
12 |
62 |
204800 |
|
|
195753417 |
tan_chao |
D |
March 3, 2023, 4:01 a.m. |
OK |
GNU C11 |
TESTS |
12 |
93 |
204800 |
|
|
195747562 |
wsyhb |
D |
March 3, 2023, 2:12 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
204800 |
|
|
195748367 |
santanhuahewu |
D |
March 3, 2023, 2:30 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
204800 |
|
|
195753612 |
qwjoj |
D |
March 3, 2023, 4:05 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
204800 |
|
|
195757879 |
ArshAgl |
D |
March 3, 2023, 5:06 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195756218 |
Knob_123 |
D |
March 3, 2023, 4:45 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195755406 |
chensunlai |
D |
March 3, 2023, 4:33 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195761157 |
Wy_g |
D |
March 3, 2023, 5:45 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195759172 |
shenyc0226 |
D |
March 3, 2023, 5:21 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195758970 |
jerseyguy |
D |
March 3, 2023, 5:19 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195758673 |
boris_johnson |
D |
March 3, 2023, 5:15 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
512000 |
|
|
195722838 |
Khaled_Al_Awad |
D |
March 2, 2023, 7:02 p.m. |
OK |
GNU C++17 |
TESTS |
9 |
15 |
204800 |
|
|
195740704 |
weeey |
D |
March 2, 2023, 11:28 p.m. |
OK |
GNU C++17 |
TESTS |
9 |
15 |
204800 |
|
|
195751527 |
MOQEE |
D |
March 3, 2023, 3:26 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
204800 |
|
|
195760864 |
anxietian |
D |
March 3, 2023, 5:41 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195760660 |
xolos |
D |
March 3, 2023, 5:39 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195760573 |
kannan_16 |
D |
March 3, 2023, 5:38 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195761630 |
debosmita1919 |
D |
March 3, 2023, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195760994 |
srishti_03 |
D |
March 3, 2023, 5:43 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195760924 |
mahiabdullah |
D |
March 3, 2023, 5:42 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195761905 |
julian_rosas |
D |
March 3, 2023, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
15 |
512000 |
|
|
195710629 |
novaa |
D |
March 2, 2023, 5:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
9 |
0 |
512000 |
|
|
195742165 |
ZiadEl-Gafy |
D |
March 3, 2023, 12:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
9 |
0 |
512000 |
|
|
195751089 |
weiliang |
D |
March 3, 2023, 3:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195754411 |
xlz |
D |
March 3, 2023, 4:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195732113 |
nishit5 |
D |
March 2, 2023, 8:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
9 |
0 |
512000 |
|
|
195741569 |
Sigma_sqr |
D |
March 2, 2023, 11:51 p.m. |
OK |
GNU C++17 (64) |
TESTS |
9 |
0 |
16588800 |
|
|
195746055 |
alixeid |
D |
March 3, 2023, 1:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
15 |
512000 |
|
|
195752572 |
hsekharsahoo |
D |
March 3, 2023, 3:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
15 |
512000 |
|
|
195750450 |
Krypthon |
D |
March 3, 2023, 3:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
15 |
512000 |
|
|
195750160 |
weakestOsuPlayer_244 |
D |
March 3, 2023, 3:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
15 |
512000 |
|
|
195739657 |
AhmedGalal |
D |
March 2, 2023, 11:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
9 |
0 |
0 |
|
|
195737085 |
ilmhd |
D |
March 2, 2023, 10:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
9 |
0 |
204800 |
|
|
195754088 |
RakibulIslam |
D |
March 3, 2023, 4:13 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195752122 |
moyifan |
D |
March 3, 2023, 3:37 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195748949 |
moonhero |
D |
March 3, 2023, 2:41 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195748445 |
MostafaAlii |
D |
March 3, 2023, 2:32 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195759424 |
younis_wagih |
D |
March 3, 2023, 5:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195759438 |
Sam5 |
D |
March 3, 2023, 5:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195761112 |
KM_Parvez |
D |
March 3, 2023, 5:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195756755 |
urparvezali |
D |
March 3, 2023, 4:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
0 |
512000 |
|
|
195736109 |
lock_infinity |
D |
March 2, 2023, 9:46 p.m. |
OK |
Java 11 |
TESTS |
9 |
156 |
0 |
|
|
195717627 |
habib_48 |
D |
March 2, 2023, 6:19 p.m. |
OK |
Java 11 |
TESTS |
9 |
170 |
0 |
|
|
195728725 |
rajgupta77540 |
D |
March 2, 2023, 7:59 p.m. |
OK |
Java 11 |
TESTS |
9 |
187 |
0 |
|
|
195725773 |
PoloBanker |
D |
March 2, 2023, 7:30 p.m. |
OK |
Java 11 |
TESTS |
9 |
187 |
0 |
|
|
195726937 |
dzhi |
D |
March 2, 2023, 7:41 p.m. |
OK |
Java 11 |
TESTS |
9 |
233 |
0 |
|
|
195717231 |
FirstException |
D |
March 2, 2023, 6:16 p.m. |
OK |
Java 11 |
TESTS |
9 |
233 |
40960000 |
|
|
195718640 |
ilasiawo |
D |
March 2, 2023, 6:27 p.m. |
OK |
Java 11 |
TESTS |
9 |
234 |
0 |
|
|
195751282 |
MrYato |
D |
March 3, 2023, 3:22 a.m. |
OK |
Java 11 |
TESTS |
12 |
249 |
0 |
|
|
195733269 |
gurkaran0209 |
D |
March 2, 2023, 8:57 p.m. |
OK |
Java 11 |
TESTS |
9 |
280 |
0 |
|
|
195710795 |
Saicharan_09 |
D |
March 2, 2023, 5:31 p.m. |
OK |
Java 11 |
TESTS |
9 |
295 |
0 |
|
|
195746540 |
SugoiTurtle |
D |
March 3, 2023, 1:48 a.m. |
OK |
Java 17 |
TESTS |
12 |
186 |
716800 |
|
|
195747843 |
Mustela_Erminea |
D |
March 3, 2023, 2:19 a.m. |
OK |
Java 17 |
TESTS |
12 |
202 |
409600 |
|
|
195712774 |
d2s2 |
D |
March 2, 2023, 5:44 p.m. |
OK |
Java 17 |
TESTS |
9 |
218 |
102400 |
|
|
195743502 |
cnlonces |
D |
March 3, 2023, 12:39 a.m. |
OK |
Java 17 |
TESTS |
12 |
218 |
307200 |
|
|
195746112 |
Ayushtripathi441 |
D |
March 3, 2023, 1:39 a.m. |
OK |
Java 17 |
TESTS |
12 |
233 |
512000 |
|
|
195734918 |
ahmedtawfik |
D |
March 2, 2023, 9:23 p.m. |
OK |
Java 17 |
TESTS |
9 |
233 |
819200 |
|
|
195739287 |
sarvesh_bawari |
D |
March 2, 2023, 10:54 p.m. |
OK |
Java 17 |
TESTS |
9 |
233 |
32972800 |
|
|
195729116 |
Adar8604 |
D |
March 2, 2023, 8:03 p.m. |
OK |
Java 17 |
TESTS |
9 |
249 |
409600 |
|
|
195709685 |
American_Eagle |
D |
March 2, 2023, 5:24 p.m. |
OK |
Java 17 |
TESTS |
9 |
265 |
102400 |
|
|
195733145 |
notreallysure |
D |
March 2, 2023, 8:55 p.m. |
OK |
Java 17 |
TESTS |
9 |
1731 |
614400 |
|
|
195752727 |
wyxfwxh250821 |
D |
March 3, 2023, 3:48 a.m. |
OK |
Java 8 |
TESTS |
12 |
108 |
0 |
|
|
195733514 |
Koka |
D |
March 2, 2023, 9 p.m. |
OK |
Java 8 |
TESTS |
9 |
109 |
0 |
|
|
195714922 |
mohamedhassan_c |
D |
March 2, 2023, 5:59 p.m. |
OK |
Java 8 |
TESTS |
9 |
109 |
5836800 |
|
|
195750402 |
chuquwan9964 |
D |
March 3, 2023, 3:06 a.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
0 |
|
|
195748932 |
cyclingle |
D |
March 3, 2023, 2:41 a.m. |
OK |
Java 8 |
TESTS |
12 |
155 |
3584000 |
|
|
195716725 |
crudeCode |
D |
March 2, 2023, 6:12 p.m. |
OK |
Java 8 |
TESTS |
9 |
156 |
0 |
|
|
195757844 |
aniket27 |
D |
March 3, 2023, 5:05 a.m. |
OK |
Java 8 |
TESTS |
12 |
187 |
0 |
|
|
195754449 |
amit_roy |
D |
March 3, 2023, 4:19 a.m. |
OK |
Java 8 |
TESTS |
12 |
187 |
0 |
|
|
195762896 |
Eunoiay |
D |
March 3, 2023, 6:04 a.m. |
OK |
Java 8 |
TESTS |
12 |
202 |
0 |
|
|
195718670 |
SCOR_PION |
D |
March 2, 2023, 6:27 p.m. |
OK |
Java 8 |
TESTS |
9 |
233 |
0 |
|
|
195735009 |
hotkey |
D |
March 2, 2023, 9:25 p.m. |
OK |
Kotlin 1.7 |
TESTS |
9 |
1388 |
129638400 |
|
|
195727967 |
153floppa |
D |
March 2, 2023, 7:52 p.m. |
OK |
MS C++ 2017 |
TESTS |
9 |
46 |
614400 |
|
|
195717122 |
dipra5565 |
D |
March 2, 2023, 6:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
9 |
46 |
614400 |
|
|
195753241 |
Defender_of_Argus |
D |
March 3, 2023, 3:57 a.m. |
OK |
Node.js |
TESTS |
12 |
124 |
6144000 |
|
|
195755524 |
corba |
D |
March 3, 2023, 4:35 a.m. |
OK |
Node.js |
TESTS |
12 |
140 |
5120000 |
|
|
195709273 |
flexr |
D |
March 2, 2023, 5:21 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
171 |
4812800 |
|
|
195752958 |
IWantToBeNutellaSomeday |
D |
March 3, 2023, 3:52 a.m. |
OK |
PyPy 3 |
TESTS |
12 |
311 |
6041600 |
|
|
195719850 |
gojo57 |
D |
March 2, 2023, 6:36 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
312 |
6144000 |
|
|
195710786 |
JUBHAI |
D |
March 2, 2023, 5:31 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
326 |
6553600 |
|
|
195711544 |
gujik |
D |
March 2, 2023, 5:35 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
327 |
6553600 |
|
|
195736630 |
Golden9 |
D |
March 2, 2023, 9:57 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
343 |
6041600 |
|
|
195715370 |
SoleProprietor |
D |
March 2, 2023, 6:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
77 |
4198400 |
|
|
195737890 |
voicon |
D |
March 2, 2023, 10:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
78 |
5632000 |
|
|
195744252 |
liuaaa |
D |
March 3, 2023, 12:57 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
92 |
6144000 |
|
|
195750423 |
InariInDream |
D |
March 3, 2023, 3:07 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
93 |
5734400 |
|
|
195748569 |
summertony717 |
D |
March 3, 2023, 2:34 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
93 |
6656000 |
|
|
195737016 |
gardengnome |
D |
March 2, 2023, 10:05 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
93 |
7065600 |
|
|
195733613 |
FlakeLCR |
D |
March 2, 2023, 9:01 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
93 |
7577600 |
|
|
195753439 |
The_MazeRunner |
D |
March 3, 2023, 4:02 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
108 |
7475200 |
|
|
195758842 |
otsuneko |
D |
March 3, 2023, 5:17 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
108 |
136704000 |
|
|
195716594 |
Su_123 |
D |
March 2, 2023, 6:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
124 |
9318400 |
|
|
195734237 |
isekun |
D |
March 2, 2023, 9:11 p.m. |
OK |
Python 3 |
TESTS |
9 |
93 |
307200 |
|
|
195752719 |
elmurad6 |
D |
March 3, 2023, 3:48 a.m. |
OK |
Python 3 |
TESTS |
12 |
124 |
0 |
|
|
195737734 |
Aadi03 |
D |
March 2, 2023, 10:20 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
0 |
|
|
195725491 |
sasivardhan3952 |
D |
March 2, 2023, 7:27 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
0 |
|
|
195721034 |
Ismail03 |
D |
March 2, 2023, 6:46 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
0 |
|
|
195711822 |
jayz7 |
D |
March 2, 2023, 5:37 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
0 |
|
|
195711811 |
lorika |
D |
March 2, 2023, 5:37 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
0 |
|
|
195741920 |
Schichow |
D |
March 3, 2023, 12:01 a.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
307200 |
|
|
195735100 |
Lullabaly |
D |
March 2, 2023, 9:27 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
307200 |
|
|
195738711 |
h_a_m_z_a |
D |
March 2, 2023, 10:42 p.m. |
OK |
Python 3 |
TESTS |
9 |
124 |
409600 |
|
|
195746109 |
novice.li |
D |
March 3, 2023, 1:39 a.m. |
OK |
Rust 2021 |
TESTS |
12 |
15 |
1945600 |
|
|
remove filters
Back to search problems