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'There is a string s of lowercase English letters. A cursor is positioned on one of the characters. The cursor can be moved with the following operation: choose a letter c and a direction (left or right). The cursor is then moved to the closest occurence of c in the chosen direction. If there is no letter c in that direction, the cursor stays in place. For example, if s = mathtt{abaab} with the cursor on the second character ( mathtt{a[b]aab} ), then: Let mathrm{dist}(i, j) be the smallest number of operations needed to move the cursor from the i -th character to the j -th character. Compute displaystyle sum_{i = 1}^n sum_{j = 1}^n mathrm{dist}(i, j) . The only line contains a non-empty string s of at most 10^5 lowercase English letters. Print a single integer displaystyle sum_{i = 1}^n sum_{j = 1}^n mathrm{dist}(i, j) . In the first sample case, mathrm{dist}(i, j) = 0 for any pair i = j , and 1 for all other pairs. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
63643087 |
skip1978 |
F |
Oct. 28, 2019, 8:45 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
217 |
79667200 |
|
3400 |
64076529 |
_twilight |
F |
Nov. 2, 2019, 8:56 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
327 |
28979200 |
|
3400 |
63527437 |
WZYYN |
F |
Oct. 27, 2019, 5:41 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
327 |
94310400 |
|
3400 |
64320636 |
LittleBeetle |
F |
Nov. 5, 2019, 3:32 p.m. |
OK |
GNU C++11 |
TESTS |
18 |
467 |
69324800 |
|
3400 |
69555933 |
luogu_bot5 |
F |
Jan. 26, 2020, 8:48 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
483 |
77107200 |
|
3400 |
63656769 |
Fuyuki |
F |
Oct. 28, 2019, 12:56 p.m. |
OK |
GNU C++11 |
TESTS |
18 |
514 |
71987200 |
|
3400 |
63657395 |
Fuyuki |
F |
Oct. 28, 2019, 1:06 p.m. |
OK |
GNU C++11 |
TESTS |
18 |
529 |
71987200 |
|
3400 |
64318001 |
luogu_bot5 |
F |
Nov. 5, 2019, 2:42 p.m. |
OK |
GNU C++11 |
TESTS |
18 |
546 |
71884800 |
|
3400 |
64074534 |
nealchen |
F |
Nov. 2, 2019, 8:26 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
592 |
85913600 |
|
3400 |
65462196 |
lzoiexplorer2004 |
F |
Nov. 21, 2019, 3:10 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
889 |
154009600 |
|
3400 |
64713107 |
Motarack |
F |
Nov. 11, 2019, 7:51 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
186 |
164249600 |
|
3400 |
63501521 |
ecnerwala |
F |
Oct. 26, 2019, 5:21 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
233 |
80179200 |
|
3400 |
63691922 |
jijiang |
F |
Oct. 29, 2019, 3:11 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
390 |
49561600 |
|
3400 |
63987208 |
jambow |
F |
Nov. 1, 2019, 12:07 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
639 |
71475200 |
|
3400 |
64070339 |
newbiegcz |
F |
Nov. 2, 2019, 7:11 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
685 |
71884800 |
|
3400 |
64297419 |
DuongNguyen |
F |
Nov. 5, 2019, 9:01 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
685 |
109158400 |
|
3400 |
65349630 |
foucault |
F |
Nov. 19, 2019, 1:51 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
701 |
109158400 |
|
3400 |
66501834 |
mayaohua2003 |
F |
Dec. 8, 2019, 12:51 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
748 |
459468800 |
|
3400 |
65133800 |
WrongAnswer67 |
F |
Nov. 16, 2019, 5:08 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
1762 |
193331200 |
|
3400 |
69570050 |
gongsuidashen |
F |
Jan. 26, 2020, 1:48 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
249 |
80179200 |
|
3400 |
65276826 |
Xellos |
F |
Nov. 18, 2019, 2:07 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
265 |
108544000 |
|
3400 |
63621911 |
SirShokoladina |
F |
Oct. 27, 2019, 11:59 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
436 |
45977600 |
|
3400 |
66272307 |
sruthi_1729 |
F |
Dec. 4, 2019, 12:43 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
468 |
71987200 |
|
3400 |
69554739 |
zhongyuwei |
F |
Jan. 26, 2020, 8:17 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
499 |
77107200 |
|
3400 |
64300928 |
user202729_ |
F |
Nov. 5, 2019, 10:02 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
529 |
459776000 |
|
3400 |
65038637 |
LJZ_C |
F |
Nov. 15, 2019, 12:37 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
576 |
348569600 |
|
3400 |
64950672 |
sigma425 |
F |
Nov. 15, 2019, 4:05 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
592 |
79360000 |
|
3400 |
64890012 |
krijgertje |
F |
Nov. 14, 2019, 2:24 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
639 |
334233600 |
|
3400 |
65517611 |
catsareliquid |
F |
Nov. 22, 2019, 6:47 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
685 |
109158400 |
|
3400 |
remove filters
Back to search problems