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"Let's denote the f(x) function for a string x as the number of distinct characters that the string contains. For example f( texttt{abc}) = 3 , f( texttt{bbbbb}) = 1 , and f( texttt{babacaba}) = 3 . Given a string s , split it into two non-empty strings a and b such that f(a) + f(b) is the maximum possible. In other words, find the maximum possible value of f(a) + f(b) such that a + b = s (the concatenation of string a and string b is equal to string s ). The input consists of multiple test cases. The first line contains an 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 an integer n ( 2 <= q n <= q 2 cdot10^5 ) -- the length of the string s . The second line contains the string s , consisting of lowercase English letters. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot10^5 . For each test case, output a single integer -- the maximum possible value of f(a) + f(b) such that a + b = s . For the first test case, there is only one valid way to split texttt{aa} into two non-empty strings texttt{a} and texttt{a} , and f( texttt{a}) + f( texttt{a}) = 1 + 1 = 2 . For the second test case, by splitting texttt{abcabcd} into texttt{abc} and texttt{abcd} we can get the answer of f( texttt{abc}) + f( texttt{abcd}) = 3 + 4 = 7 which is maximum possible. For the third test case, it doesn't matter how we split the string, the answer will always be 2 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
192053393 |
nksammirPL |
D |
Feb. 3, 2023, 6:14 p.m. |
OK |
C# 10 |
TESTS |
8 |
108 |
11468800 |
|
|
192082430 |
Smallorange |
D |
Feb. 4, 2023, 12:23 a.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
24780800 |
|
|
192095570 |
dlwc |
D |
Feb. 4, 2023, 4:24 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1228800 |
|
|
192088424 |
zixiangcode |
D |
Feb. 4, 2023, 2:30 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1536000 |
|
|
192090320 |
Ankur_Sharma |
D |
Feb. 4, 2023, 2:59 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1536000 |
|
|
192091363 |
dasher2238 |
D |
Feb. 4, 2023, 3:17 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1638400 |
|
|
192082945 |
yuanhuayang |
D |
Feb. 4, 2023, 12:37 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1638400 |
|
|
192050345 |
Naim_Hasan_Pappu |
D |
Feb. 3, 2023, 5:55 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1638400 |
|
|
192103286 |
Shuishui_0921 |
D |
Feb. 4, 2023, 5:49 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
1638400 |
|
|
192065179 |
Rely_on_Allah |
D |
Feb. 3, 2023, 7:48 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
2560000 |
|
|
192076056 |
Jiraiya_Kun |
D |
Feb. 3, 2023, 10:01 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
3174400 |
|
|
192083530 |
justD1o |
D |
Feb. 4, 2023, 12:52 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
3276800 |
|
|
192050236 |
FourierNull |
D |
Feb. 3, 2023, 5:54 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1228800 |
|
|
192062121 |
Oscar-gg |
D |
Feb. 3, 2023, 7:20 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1228800 |
|
|
192060591 |
shayonp |
D |
Feb. 3, 2023, 7:07 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1331200 |
|
|
192069732 |
atrux |
D |
Feb. 3, 2023, 8:36 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1433600 |
|
|
192100560 |
Mars_Coder |
D |
Feb. 4, 2023, 5:23 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1536000 |
|
|
192082242 |
gabriel88766 |
D |
Feb. 4, 2023, 12:19 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1536000 |
|
|
192071369 |
itsrohit |
D |
Feb. 3, 2023, 8:55 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1536000 |
|
|
192065602 |
Meem-Seen |
D |
Feb. 3, 2023, 7:52 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1536000 |
|
|
192060430 |
Electroboom |
D |
Feb. 3, 2023, 7:05 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1536000 |
|
|
192104481 |
vivek1208 |
D |
Feb. 4, 2023, 5:59 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
1536000 |
|
|
192073107 |
Maram |
D |
Feb. 3, 2023, 9:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
3174400 |
|
|
192065574 |
Prithvi_Rajan |
D |
Feb. 3, 2023, 7:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
1433600 |
|
|
192071701 |
LuckyRoo |
D |
Feb. 3, 2023, 8:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
1433600 |
|
|
192088323 |
xlxys |
D |
Feb. 4, 2023, 2:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
1740800 |
|
|
192096054 |
Hytidel |
D |
Feb. 4, 2023, 4:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
1740800 |
|
|
192052103 |
enslaved |
D |
Feb. 3, 2023, 6:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
2457600 |
|
|
192102479 |
OTTFF |
D |
Feb. 4, 2023, 5:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
2560000 |
|
|
192081643 |
Wuyanru |
D |
Feb. 4, 2023, 12:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
2969600 |
|
|
192087724 |
kuchibi |
D |
Feb. 4, 2023, 2:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
3379200 |
|
|
192081152 |
Atlas_ |
D |
Feb. 3, 2023, 11:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
3379200 |
|
|
192068681 |
gupta_gopal |
D |
Feb. 3, 2023, 8:23 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
1331200 |
|
|
192054957 |
Tourist-Egypt |
D |
Feb. 3, 2023, 6:24 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
1433600 |
|
|
192076866 |
Lion_Heart |
D |
Feb. 3, 2023, 10:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
1433600 |
|
|
192048905 |
Zadymiarz1234 |
D |
Feb. 3, 2023, 5:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
1638400 |
|
|
192087415 |
Fei_xiangShi |
D |
Feb. 4, 2023, 2:14 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
1945600 |
|
|
192072239 |
Meem-Seen |
D |
Feb. 3, 2023, 9:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
1945600 |
|
|
192082387 |
yikkk |
D |
Feb. 4, 2023, 12:22 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
3379200 |
|
|
192103344 |
LeslieKang |
D |
Feb. 4, 2023, 5:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
5017600 |
|
|
192086636 |
dengziyue |
D |
Feb. 4, 2023, 1:59 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
15 |
1331200 |
|
|
192086279 |
wumingen |
D |
Feb. 4, 2023, 1:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
15 |
1433600 |
|
|
192054223 |
dimaglushkov |
D |
Feb. 3, 2023, 6:19 p.m. |
OK |
Go |
TESTS |
8 |
31 |
18227200 |
|
|
192079352 |
meinego |
D |
Feb. 3, 2023, 11:04 p.m. |
OK |
Go |
TESTS |
8 |
46 |
19660800 |
|
|
192088607 |
july_tang |
D |
Feb. 4, 2023, 2:33 a.m. |
OK |
Go |
TESTS |
8 |
78 |
22630400 |
|
|
192055416 |
Hawater |
D |
Feb. 3, 2023, 6:27 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
24678400 |
|
|
192057874 |
sduMamytbekov |
D |
Feb. 3, 2023, 6:45 p.m. |
OK |
Java 11 |
TESTS |
8 |
186 |
24678400 |
|
|
192053110 |
LZYu |
D |
Feb. 3, 2023, 6:12 p.m. |
OK |
Java 11 |
TESTS |
8 |
218 |
24576000 |
|
|
192054611 |
Extradict |
D |
Feb. 3, 2023, 6:22 p.m. |
OK |
Java 11 |
TESTS |
8 |
218 |
24883200 |
|
|
192099586 |
white_harmony |
D |
Feb. 4, 2023, 5:14 a.m. |
OK |
Java 11 |
TESTS |
8 |
218 |
25088000 |
|
|
192094662 |
yudi23 |
D |
Feb. 4, 2023, 4:11 a.m. |
OK |
Java 11 |
TESTS |
8 |
233 |
24678400 |
|
|
192091711 |
souravc399 |
D |
Feb. 4, 2023, 3:22 a.m. |
OK |
Java 11 |
TESTS |
8 |
233 |
24678400 |
|
|
192096006 |
iknownothing13 |
D |
Feb. 4, 2023, 4:30 a.m. |
OK |
Java 11 |
TESTS |
8 |
264 |
24576000 |
|
|
192095373 |
vikasmanohar.1995 |
D |
Feb. 4, 2023, 4:21 a.m. |
OK |
Java 11 |
TESTS |
8 |
264 |
24883200 |
|
|
192093217 |
Prachith_107 |
D |
Feb. 4, 2023, 3:48 a.m. |
OK |
Java 11 |
TESTS |
8 |
280 |
25292800 |
|
|
192090395 |
izano |
D |
Feb. 4, 2023, 3:01 a.m. |
OK |
Java 17 |
TESTS |
8 |
202 |
40448000 |
|
|
192085800 |
burning_summer |
D |
Feb. 4, 2023, 1:43 a.m. |
OK |
Java 17 |
TESTS |
8 |
217 |
40243200 |
|
|
192100092 |
Mustela_Erminea |
D |
Feb. 4, 2023, 5:19 a.m. |
OK |
Java 17 |
TESTS |
8 |
218 |
40448000 |
|
|
192055441 |
max. |
D |
Feb. 3, 2023, 6:27 p.m. |
OK |
Java 17 |
TESTS |
8 |
233 |
40140800 |
|
|
192092146 |
sauravmandal |
D |
Feb. 4, 2023, 3:29 a.m. |
OK |
Java 17 |
TESTS |
8 |
233 |
40448000 |
|
|
192089502 |
Jatinydv17 |
D |
Feb. 4, 2023, 2:47 a.m. |
OK |
Java 17 |
TESTS |
8 |
233 |
40448000 |
|
|
192071630 |
Yousef_Badr |
D |
Feb. 3, 2023, 8:58 p.m. |
OK |
Java 17 |
TESTS |
8 |
248 |
40448000 |
|
|
192099960 |
GooseGoop |
D |
Feb. 4, 2023, 5:18 a.m. |
OK |
Java 17 |
TESTS |
8 |
249 |
40448000 |
|
|
192062990 |
tejasdharmik12 |
D |
Feb. 3, 2023, 7:29 p.m. |
OK |
Java 17 |
TESTS |
8 |
296 |
40448000 |
|
|
192054868 |
BrilliantMate |
D |
Feb. 3, 2023, 6:23 p.m. |
OK |
Java 17 |
TESTS |
8 |
1824 |
40038400 |
|
|
192089616 |
Jtnydv |
D |
Feb. 4, 2023, 2:49 a.m. |
OK |
Java 8 |
TESTS |
8 |
93 |
18944000 |
|
|
192085552 |
mohamedhassan_c |
D |
Feb. 4, 2023, 1:38 a.m. |
OK |
Java 8 |
TESTS |
8 |
108 |
18944000 |
|
|
192058421 |
anomylus8877 |
D |
Feb. 3, 2023, 6:49 p.m. |
OK |
Java 8 |
TESTS |
8 |
109 |
18841600 |
|
|
192053325 |
Zicode |
D |
Feb. 3, 2023, 6:13 p.m. |
OK |
Java 8 |
TESTS |
8 |
124 |
25190400 |
|
|
192097891 |
bleach__ |
D |
Feb. 4, 2023, 4:55 a.m. |
OK |
Java 8 |
TESTS |
8 |
156 |
18944000 |
|
|
192072083 |
CodeNoob124 |
D |
Feb. 3, 2023, 9:04 p.m. |
OK |
Java 8 |
TESTS |
8 |
171 |
18944000 |
|
|
192064997 |
Aika426 |
D |
Feb. 3, 2023, 7:46 p.m. |
OK |
Java 8 |
TESTS |
8 |
187 |
18944000 |
|
|
192102579 |
harishkumarn |
D |
Feb. 4, 2023, 5:42 a.m. |
OK |
Java 8 |
TESTS |
8 |
202 |
19660800 |
|
|
192048970 |
Sylvester_ |
D |
Feb. 3, 2023, 5:46 p.m. |
OK |
Java 8 |
TESTS |
8 |
217 |
0 |
|
|
192060109 |
Kudiret |
D |
Feb. 3, 2023, 7:03 p.m. |
OK |
Java 8 |
TESTS |
8 |
218 |
19558400 |
|
|
192087139 |
linxiaotian |
D |
Feb. 4, 2023, 2:09 a.m. |
OK |
Kotlin 1.6 |
TESTS |
8 |
202 |
26521600 |
|
|
192071224 |
Dimer15 |
D |
Feb. 3, 2023, 8:54 p.m. |
OK |
Kotlin 1.6 |
TESTS |
8 |
249 |
25600000 |
|
|
192101966 |
Deadigle |
D |
Feb. 4, 2023, 5:36 a.m. |
OK |
Kotlin 1.7 |
TESTS |
8 |
545 |
134348800 |
|
|
192100517 |
Deadigle |
D |
Feb. 4, 2023, 5:23 a.m. |
OK |
Kotlin 1.7 |
TESTS |
8 |
608 |
151756800 |
|
|
192097648 |
Deadigle |
D |
Feb. 4, 2023, 4:52 a.m. |
OK |
Kotlin 1.7 |
TESTS |
8 |
655 |
121548800 |
|
|
192104322 |
Deadigle |
D |
Feb. 4, 2023, 5:58 a.m. |
OK |
Kotlin 1.7 |
TESTS |
8 |
670 |
129024000 |
|
|
192088378 |
wxz233 |
D |
Feb. 4, 2023, 2:29 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
15 |
2969600 |
|
|
192102500 |
megi_ |
D |
Feb. 4, 2023, 5:41 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
31 |
4812800 |
|
|
192056894 |
1_shivam |
D |
Feb. 3, 2023, 6:38 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
62 |
4096000 |
|
|
192059589 |
Mohamed_Hamed |
D |
Feb. 3, 2023, 6:58 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
140 |
30822400 |
|
|
192070247 |
Mansurbek |
D |
Feb. 3, 2023, 8:42 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
155 |
21708800 |
|
|
192095701 |
Yash_Nandwana |
D |
Feb. 4, 2023, 4:26 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
155 |
32972800 |
|
|
192056657 |
zx4r |
D |
Feb. 3, 2023, 6:36 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
358 |
23859200 |
|
|
192063598 |
anadiparmar35 |
D |
Feb. 3, 2023, 7:33 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
358 |
26009600 |
|
|
192099181 |
ashuashutosh2211 |
D |
Feb. 4, 2023, 5:10 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
358 |
27750400 |
|
|
192078498 |
Dash_____ |
D |
Feb. 3, 2023, 10:46 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
373 |
23040000 |
|
|
192082021 |
abraccadabra |
D |
Feb. 4, 2023, 12:12 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
405 |
26931200 |
|
|
192083223 |
mohak_k |
D |
Feb. 4, 2023, 12:44 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
421 |
26828800 |
|
|
192074060 |
WalrusRamen21 |
D |
Feb. 3, 2023, 9:31 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
592 |
20684800 |
|
|
192100575 |
anshumannandan |
D |
Feb. 4, 2023, 5:24 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
108 |
34099200 |
|
|
192087494 |
liuaaa |
D |
Feb. 4, 2023, 2:15 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
109 |
42803200 |
|
|
192082343 |
crapcode |
D |
Feb. 4, 2023, 12:21 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
124 |
36556800 |
|
|
192088017 |
zjcccc |
D |
Feb. 4, 2023, 2:23 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
139 |
32870400 |
|
|
192103671 |
meat124 |
D |
Feb. 4, 2023, 5:52 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
139 |
42700800 |
|
|
192085272 |
InariInDream |
D |
Feb. 4, 2023, 1:33 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
155 |
36659200 |
|
|
192050810 |
JinYuManTang |
D |
Feb. 3, 2023, 5:57 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
170 |
42700800 |
|
|
192050332 |
JinYuManTang |
D |
Feb. 3, 2023, 5:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
43724800 |
|
|
192074093 |
slickk |
D |
Feb. 3, 2023, 9:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
186 |
32051200 |
|
|
192095421 |
lfcui |
D |
Feb. 4, 2023, 4:22 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
187 |
48128000 |
|
|
192070020 |
DonC |
D |
Feb. 3, 2023, 8:39 p.m. |
OK |
Python 3 |
TESTS |
8 |
171 |
4915200 |
|
|
192048770 |
_bidhayak |
D |
Feb. 3, 2023, 5:45 p.m. |
OK |
Python 3 |
TESTS |
8 |
171 |
5836800 |
|
|
192068518 |
omark1212 |
D |
Feb. 3, 2023, 8:22 p.m. |
OK |
Python 3 |
TESTS |
8 |
187 |
5222400 |
|
|
192099985 |
tariq05 |
D |
Feb. 4, 2023, 5:18 a.m. |
OK |
Python 3 |
TESTS |
8 |
202 |
5324800 |
|
|
192057108 |
rostoki |
D |
Feb. 3, 2023, 6:39 p.m. |
OK |
Python 3 |
TESTS |
8 |
202 |
7372800 |
|
|
192084237 |
Danny19 |
D |
Feb. 4, 2023, 1:08 a.m. |
OK |
Python 3 |
TESTS |
8 |
202 |
7987200 |
|
|
192094082 |
Sobr1k |
D |
Feb. 4, 2023, 4:02 a.m. |
OK |
Python 3 |
TESTS |
8 |
218 |
5324800 |
|
|
192048740 |
Kwh123 |
D |
Feb. 3, 2023, 5:45 p.m. |
OK |
Python 3 |
TESTS |
8 |
233 |
4812800 |
|
|
192072562 |
J_Nas |
D |
Feb. 3, 2023, 9:10 p.m. |
OK |
Python 3 |
TESTS |
8 |
249 |
5222400 |
|
|
192052525 |
Feras_M_Almomani |
D |
Feb. 3, 2023, 6:08 p.m. |
OK |
Python 3 |
TESTS |
8 |
265 |
4915200 |
|
|
192075817 |
Hyrulia |
D |
Feb. 3, 2023, 9:57 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
15 |
3686400 |
|
|
192061880 |
Bore_lis |
D |
Feb. 3, 2023, 7:18 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
77 |
1228800 |
|
|
192062641 |
franv |
D |
Feb. 3, 2023, 7:25 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
93 |
3072000 |
|
|
192081544 |
bkifhr9 |
D |
Feb. 4, 2023, midnight |
OK |
Rust 2021 |
TESTS |
8 |
124 |
3276800 |
|
|
remove filters
Back to search problems