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 string s of length n . Let's define two operations you can apply on the string: Your task is to find the number of distinct non-empty strings that can be generated by applying the given operations on the initial string any number of times (possibly zero), in any order. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains n ( 1 <= q n <= q 10^5 ) -- the length of the string. The second line of each test case contains the string s . It is guaranteed that the string only contains lowercase letters of the English alphabet. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer: the number of distinct non-empty strings you can get. In the first test case, we can get the following strings: a , aa , aaa , aaaa , aaaaa . In the third test case, for example, the word ba can be reached in the following way: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
238767740 |
bluemegane |
B |
Dec. 24, 2023, 10:44 p.m. |
OK |
C# 8 |
TESTS |
57 |
124 |
11571200 |
|
|
238767624 |
bluemegane |
B |
Dec. 24, 2023, 10:40 p.m. |
OK |
C# 8 |
TESTS |
57 |
139 |
11878400 |
|
|
238767421 |
bluemegane |
B |
Dec. 24, 2023, 10:35 p.m. |
OK |
C# 8 |
TESTS |
57 |
186 |
11571200 |
|
|
238763989 |
arnavra3 |
B |
Dec. 24, 2023, 9:10 p.m. |
OK |
GNU C11 |
TESTS |
57 |
62 |
4096000 |
|
|
238777227 |
AFrAYuRmbrM |
B |
Dec. 25, 2023, 3:32 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
15 |
1228800 |
|
|
238750200 |
_Atharva |
B |
Dec. 24, 2023, 6:14 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
15 |
1536000 |
|
|
238766489 |
Helixion |
B |
Dec. 24, 2023, 10:07 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
15 |
1536000 |
|
|
238752683 |
jainaditya8464 |
B |
Dec. 24, 2023, 6:34 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
15 |
1536000 |
|
|
238756813 |
tahoangquan2 |
B |
Dec. 24, 2023, 7:20 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
30 |
1331200 |
|
|
238788310 |
4KASA786 |
B |
Dec. 25, 2023, 5:58 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
30 |
1536000 |
|
|
238733479 |
HoriaB |
B |
Dec. 24, 2023, 4:23 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
31 |
1024000 |
|
|
238769852 |
AFrAYuRmbrM |
B |
Dec. 24, 2023, 11:56 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
31 |
1126400 |
|
|
238772556 |
xtx20041017 |
B |
Dec. 25, 2023, 1:38 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
31 |
1126400 |
|
|
238767334 |
omeganot |
B |
Dec. 24, 2023, 10:32 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
31 |
1433600 |
|
|
238767738 |
MouadKassimi |
B |
Dec. 24, 2023, 10:44 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238766063 |
Vishvesh.26_ |
B |
Dec. 24, 2023, 9:57 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238754351 |
abhijay29 |
B |
Dec. 24, 2023, 6:50 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238754295 |
kai-zen |
B |
Dec. 24, 2023, 6:50 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238753450 |
garv_24 |
B |
Dec. 24, 2023, 6:41 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238784599 |
rk9120 |
B |
Dec. 25, 2023, 5:20 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238742568 |
unknown_ajay |
B |
Dec. 24, 2023, 5:32 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238744032 |
fahad1247 |
B |
Dec. 24, 2023, 5:37 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1536000 |
|
|
238744207 |
Orca64 |
B |
Dec. 24, 2023, 5:38 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
15 |
1843200 |
|
|
238759026 |
garvit_ |
B |
Dec. 24, 2023, 7:51 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
30 |
1228800 |
|
|
238772280 |
super_kky |
B |
Dec. 25, 2023, 1:29 a.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1331200 |
|
|
238733556 |
softwarej |
B |
Dec. 24, 2023, 4:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1331200 |
|
|
238746618 |
Vasu_ |
B |
Dec. 24, 2023, 5:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1638400 |
|
|
238783187 |
fzyz2020 |
B |
Dec. 25, 2023, 5:04 a.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1638400 |
|
|
238778713 |
jie_god |
B |
Dec. 25, 2023, 3:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1638400 |
|
|
238775703 |
GoogleBot |
B |
Dec. 25, 2023, 3:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1638400 |
|
|
238772750 |
enslaved |
B |
Dec. 25, 2023, 1:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1638400 |
|
|
238742516 |
akwa_blue |
B |
Dec. 24, 2023, 5:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
1638400 |
|
|
238774341 |
LCYang |
B |
Dec. 25, 2023, 2:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
2457600 |
|
|
238766250 |
fclvbfm934 |
B |
Dec. 24, 2023, 10:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
57 |
15 |
3072000 |
|
|
238742284 |
yumkam |
B |
Dec. 24, 2023, 5:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1331200 |
|
|
238744720 |
ak.mpbf |
B |
Dec. 24, 2023, 5:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1331200 |
|
|
238743878 |
Aish_14 |
B |
Dec. 24, 2023, 5:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1331200 |
|
|
238785580 |
mahirfaisal154 |
B |
Dec. 25, 2023, 5:29 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238784761 |
Tushars_07 |
B |
Dec. 25, 2023, 5:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238786801 |
omemi |
B |
Dec. 25, 2023, 5:41 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238787805 |
_AkashKumar_ |
B |
Dec. 25, 2023, 5:53 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238787158 |
aliazgor_rumi |
B |
Dec. 25, 2023, 5:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238786319 |
hopeWorse |
B |
Dec. 25, 2023, 5:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238785690 |
sanjayprajapati |
B |
Dec. 25, 2023, 5:30 a.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
15 |
1536000 |
|
|
238738596 |
kevbamboo |
B |
Dec. 24, 2023, 4:34 p.m. |
OK |
Java 11 |
TESTS |
57 |
202 |
24576000 |
|
|
238779530 |
AtinRoy |
B |
Dec. 25, 2023, 4:13 a.m. |
OK |
Java 11 |
TESTS |
57 |
202 |
24678400 |
|
|
238757620 |
vijender_8601 |
B |
Dec. 24, 2023, 7:31 p.m. |
OK |
Java 11 |
TESTS |
57 |
202 |
24678400 |
|
|
238783126 |
KlayThompson11 |
B |
Dec. 25, 2023, 5:04 a.m. |
OK |
Java 11 |
TESTS |
57 |
218 |
24576000 |
|
|
238784277 |
achal5623 |
B |
Dec. 25, 2023, 5:17 a.m. |
OK |
Java 11 |
TESTS |
57 |
249 |
24678400 |
|
|
238760785 |
Baniya_09 |
B |
Dec. 24, 2023, 8:16 p.m. |
OK |
Java 11 |
TESTS |
57 |
296 |
25395200 |
|
|
238744053 |
siddhartha_bose |
B |
Dec. 24, 2023, 5:37 p.m. |
OK |
Java 11 |
TESTS |
57 |
312 |
25395200 |
|
|
238759234 |
FirstException |
B |
Dec. 24, 2023, 7:53 p.m. |
OK |
Java 11 |
TESTS |
57 |
327 |
25395200 |
|
|
238750484 |
rn_das_2004 |
B |
Dec. 24, 2023, 6:16 p.m. |
OK |
Java 11 |
TESTS |
57 |
342 |
25395200 |
|
|
238767714 |
sliu17 |
B |
Dec. 24, 2023, 10:43 p.m. |
OK |
Java 17 |
TESTS |
57 |
217 |
40345600 |
|
|
238754666 |
Utsav82 |
B |
Dec. 24, 2023, 6:54 p.m. |
OK |
Java 17 |
TESTS |
57 |
218 |
40550400 |
|
|
238769528 |
jimmyd211 |
B |
Dec. 24, 2023, 11:44 p.m. |
OK |
Java 17 |
TESTS |
57 |
233 |
40550400 |
|
|
238775910 |
agarwaldivyanshu23 |
B |
Dec. 25, 2023, 3:07 a.m. |
OK |
Java 17 |
TESTS |
57 |
249 |
40448000 |
|
|
238737429 |
mo_heat |
B |
Dec. 24, 2023, 4:32 p.m. |
OK |
Java 17 |
TESTS |
57 |
249 |
40448000 |
|
|
238742623 |
BankaiOppa |
B |
Dec. 24, 2023, 5:32 p.m. |
OK |
Java 17 |
TESTS |
57 |
296 |
40243200 |
|
|
238775329 |
Raging_Shashank |
B |
Dec. 25, 2023, 2:54 a.m. |
OK |
Java 17 |
TESTS |
57 |
311 |
40755200 |
|
|
238781713 |
21wh1a0237 |
B |
Dec. 25, 2023, 4:45 a.m. |
OK |
Java 17 |
TESTS |
57 |
311 |
40857600 |
|
|
238781497 |
prateeksama2003 |
B |
Dec. 25, 2023, 4:42 a.m. |
OK |
Java 17 |
TESTS |
57 |
311 |
40857600 |
|
|
238737249 |
pop12 |
B |
Dec. 24, 2023, 4:32 p.m. |
OK |
Java 17 |
TESTS |
57 |
326 |
40652800 |
|
|
238765233 |
adarsh_goku |
B |
Dec. 24, 2023, 9:37 p.m. |
OK |
Java 21 |
TESTS |
57 |
327 |
41984000 |
|
|
238748016 |
swatishivam23 |
B |
Dec. 24, 2023, 5:59 p.m. |
OK |
Java 21 |
TESTS |
57 |
342 |
42188800 |
|
|
238737352 |
dear_earth |
B |
Dec. 24, 2023, 4:32 p.m. |
OK |
Java 21 |
TESTS |
57 |
343 |
41984000 |
|
|
238745870 |
aditya_parate |
B |
Dec. 24, 2023, 5:46 p.m. |
OK |
Java 21 |
TESTS |
57 |
374 |
42291200 |
|
|
238734248 |
Manas421321 |
B |
Dec. 24, 2023, 4:25 p.m. |
OK |
Java 21 |
TESTS |
57 |
374 |
42291200 |
|
|
238741928 |
sumeet_100 |
B |
Dec. 24, 2023, 5:29 p.m. |
OK |
Java 21 |
TESTS |
57 |
389 |
42700800 |
|
|
238750438 |
rn_das_2004 |
B |
Dec. 24, 2023, 6:16 p.m. |
OK |
Java 21 |
TESTS |
57 |
405 |
42393600 |
|
|
238736087 |
whitespace07 |
B |
Dec. 24, 2023, 4:30 p.m. |
OK |
Java 21 |
TESTS |
57 |
405 |
42393600 |
|
|
238733191 |
namansarda2007 |
B |
Dec. 24, 2023, 4:23 p.m. |
OK |
Java 21 |
TESTS |
57 |
420 |
42291200 |
|
|
238748382 |
gm_gautam |
B |
Dec. 24, 2023, 6:01 p.m. |
OK |
Java 21 |
TESTS |
57 |
436 |
42291200 |
|
|
238783979 |
arpita010 |
B |
Dec. 25, 2023, 5:13 a.m. |
OK |
Java 8 |
TESTS |
57 |
124 |
18944000 |
|
|
238744747 |
harsh_1806 |
B |
Dec. 24, 2023, 5:40 p.m. |
OK |
Java 8 |
TESTS |
57 |
140 |
18944000 |
|
|
238743943 |
harsh_1806 |
B |
Dec. 24, 2023, 5:37 p.m. |
OK |
Java 8 |
TESTS |
57 |
155 |
18944000 |
|
|
238744855 |
harsh_1806 |
B |
Dec. 24, 2023, 5:41 p.m. |
OK |
Java 8 |
TESTS |
57 |
156 |
19046400 |
|
|
238754473 |
Sumitsingh7 |
B |
Dec. 24, 2023, 6:52 p.m. |
OK |
Java 8 |
TESTS |
57 |
202 |
28672000 |
|
|
238745969 |
nikhilsoni2910 |
B |
Dec. 24, 2023, 5:47 p.m. |
OK |
Java 8 |
TESTS |
57 |
234 |
19660800 |
|
|
238750368 |
rn_das_2004 |
B |
Dec. 24, 2023, 6:15 p.m. |
OK |
Java 8 |
TESTS |
57 |
248 |
19660800 |
|
|
238786797 |
Bheem_1 |
B |
Dec. 25, 2023, 5:41 a.m. |
OK |
Java 8 |
TESTS |
57 |
249 |
19660800 |
|
|
238742497 |
priyaroy3370 |
B |
Dec. 24, 2023, 5:32 p.m. |
OK |
Java 8 |
TESTS |
57 |
249 |
19660800 |
|
|
238785096 |
chengzijun_de_xiatian |
B |
Dec. 25, 2023, 5:25 a.m. |
OK |
Java 8 |
TESTS |
57 |
249 |
19763200 |
|
|
238771899 |
IANNN |
B |
Dec. 25, 2023, 1:16 a.m. |
OK |
MS C++ 2017 |
TESTS |
57 |
62 |
1433600 |
|
|
238763774 |
Aneeba |
B |
Dec. 24, 2023, 9:06 p.m. |
OK |
MS C++ 2017 |
TESTS |
57 |
62 |
1433600 |
|
|
238756502 |
raj.priyam857885 |
B |
Dec. 24, 2023, 7:17 p.m. |
OK |
MS C++ 2017 |
TESTS |
57 |
62 |
1433600 |
|
|
238765844 |
rsFalse |
B |
Dec. 24, 2023, 9:52 p.m. |
OK |
Perl |
TESTS |
57 |
108 |
1740800 |
|
|
238768438 |
rasheed_ashen_one |
B |
Dec. 24, 2023, 11:05 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
140 |
22016000 |
|
|
238751727 |
4rn4vg |
B |
Dec. 24, 2023, 6:26 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
311 |
23552000 |
|
|
238781483 |
AnirudhBharatiya |
B |
Dec. 25, 2023, 4:42 a.m. |
OK |
PyPy 3 |
TESTS |
57 |
326 |
23449600 |
|
|
238746719 |
belyak_anya |
B |
Dec. 24, 2023, 5:51 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
327 |
23449600 |
|
|
238736611 |
Tharun_P.T.S |
B |
Dec. 24, 2023, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
342 |
23244800 |
|
|
238732405 |
urejgi |
B |
Dec. 24, 2023, 4:21 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
342 |
24371200 |
|
|
238742895 |
jvatsal0709 |
B |
Dec. 24, 2023, 5:33 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
358 |
23449600 |
|
|
238738706 |
CS_S |
B |
Dec. 24, 2023, 4:34 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
358 |
24166400 |
|
|
238750829 |
lisashi |
B |
Dec. 24, 2023, 6:18 p.m. |
OK |
PyPy 3 |
TESTS |
57 |
389 |
24678400 |
|
|
238757697 |
Reprogram0891 |
B |
Dec. 24, 2023, 7:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
93 |
35532800 |
|
|
238763458 |
sanya |
B |
Dec. 24, 2023, 9 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
108 |
33996800 |
|
|
238734664 |
Rash |
B |
Dec. 24, 2023, 4:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
124 |
35430400 |
|
|
238743702 |
alexwice |
B |
Dec. 24, 2023, 5:36 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
124 |
35635200 |
|
|
238753965 |
DarkTemplarDrop |
B |
Dec. 24, 2023, 6:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
124 |
36147200 |
|
|
238750732 |
Ganxel |
B |
Dec. 24, 2023, 6:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
124 |
36966400 |
|
|
238733869 |
MikasaAckerman5890 |
B |
Dec. 24, 2023, 4:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
124 |
37478400 |
|
|
238750876 |
gardengnome |
B |
Dec. 24, 2023, 6:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
140 |
35635200 |
|
|
238770312 |
tlsgusrb314 |
B |
Dec. 25, 2023, 12:14 a.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
140 |
36556800 |
|
|
238759412 |
its_believe |
B |
Dec. 24, 2023, 7:56 p.m. |
OK |
PyPy 3-64 |
TESTS |
57 |
155 |
38502400 |
|
|
238756448 |
beleir101 |
B |
Dec. 24, 2023, 7:16 p.m. |
OK |
Python 3 |
TESTS |
57 |
78 |
6860800 |
|
|
238733738 |
eugalt |
B |
Dec. 24, 2023, 4:24 p.m. |
OK |
Python 3 |
TESTS |
57 |
93 |
7475200 |
|
|
238759358 |
Amgadshrief |
B |
Dec. 24, 2023, 7:55 p.m. |
OK |
Python 3 |
TESTS |
57 |
108 |
6246400 |
|
|
238748781 |
Kaushal655 |
B |
Dec. 24, 2023, 6:04 p.m. |
OK |
Python 3 |
TESTS |
57 |
109 |
6144000 |
|
|
238746258 |
srikanth404 |
B |
Dec. 24, 2023, 5:48 p.m. |
OK |
Python 3 |
TESTS |
57 |
109 |
6144000 |
|
|
238746282 |
lapras100 |
B |
Dec. 24, 2023, 5:48 p.m. |
OK |
Python 3 |
TESTS |
57 |
109 |
6246400 |
|
|
238749232 |
Saidmurod |
B |
Dec. 24, 2023, 6:07 p.m. |
OK |
Python 3 |
TESTS |
57 |
109 |
6553600 |
|
|
238788544 |
2100030468 |
B |
Dec. 25, 2023, 6 a.m. |
OK |
Python 3 |
TESTS |
57 |
109 |
7475200 |
|
|
238780917 |
v2110030321 |
B |
Dec. 25, 2023, 4:34 a.m. |
OK |
Python 3 |
TESTS |
57 |
109 |
7475200 |
|
|
238780108 |
helltractor |
B |
Dec. 25, 2023, 4:21 a.m. |
OK |
Python 3 |
TESTS |
57 |
124 |
6041600 |
|
|
238759580 |
vstiff |
B |
Dec. 24, 2023, 7:58 p.m. |
OK |
Rust 2021 |
TESTS |
57 |
93 |
1536000 |
|
|
remove filters
Back to search problems