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 , consisting of lowercase Latin letters. There's a cursor, initially placed between two adjacent letters of the string. The cursor can't be placed before the first or after the last letter. In one move, you can perform one of three actions: You are asked m queries. In each query, you are given two integers f and t , which correspond to two valid positions of the cursor in the string. In response to the query, you have to calculate the minimum number of operations required to move the cursor from position f to position t . The first line contains a string s ( 2 <= |s| <= 5 cdot 10^4 ), consisting of lowercase Latin letters. The second line contains a single integer m ( 1 <= m <= 5 cdot 10^4 ) -- the number of queries. The i -th of the next m lines contains two integers f and t ( 1 <= f, t <= |s| - 1 ) -- the initial and the target positions of the cursor in the i -th query. Position x means that the cursor is between the x -th and the (x+1) -st letters of the string ( 1 -indexed). For each query, print the minimum number of actions required to move the cursor from position f to position t . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
219343525 |
rainboy |
E |
Aug. 17, 2023, 4:33 p.m. |
OK |
GNU C11 |
TESTS |
27 |
1263 |
136704000 |
|
|
219360030 |
NgoTham |
E |
Aug. 17, 2023, 6:11 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
1138 |
136704000 |
|
|
219386124 |
InvisibleX |
E |
Aug. 18, 2023, 1:32 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
1154 |
137011200 |
|
|
219346425 |
Belief_yfly |
E |
Aug. 17, 2023, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
1341 |
314982400 |
|
|
219380432 |
pengyantong |
E |
Aug. 17, 2023, 11:03 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
1403 |
181760000 |
|
|
219380101 |
omeganot |
E |
Aug. 17, 2023, 10:54 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
1419 |
140185600 |
|
|
219402076 |
SatwikChappidi |
E |
Aug. 18, 2023, 5:30 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
1560 |
142643200 |
|
|
219392501 |
dongyinjie001 |
E |
Aug. 18, 2023, 3:18 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
1575 |
137625600 |
|
|
219393697 |
JBJF |
E |
Aug. 18, 2023, 3:35 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
1918 |
223334400 |
|
|
219383134 |
t98slider |
E |
Aug. 18, 2023, 12:26 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
1934 |
142848000 |
|
|
219383913 |
t98slider |
E |
Aug. 18, 2023, 12:47 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
2074 |
143052800 |
|
|
219344205 |
antonis.white |
E |
Aug. 17, 2023, 4:34 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
842 |
273203200 |
|
|
219367972 |
Nedal |
E |
Aug. 17, 2023, 7:34 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
889 |
3686400 |
|
|
219367890 |
pab2 |
E |
Aug. 17, 2023, 7:33 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
982 |
186880000 |
|
|
219387905 |
Lucky7 |
E |
Aug. 18, 2023, 2:03 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
1014 |
8806400 |
|
|
219351231 |
kimmoqt |
E |
Aug. 17, 2023, 5:03 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
1247 |
136704000 |
|
|
219368630 |
Spidy01 |
E |
Aug. 17, 2023, 7:41 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
1262 |
136396800 |
|
|
219385141 |
pavlukivan |
E |
Aug. 18, 2023, 1:13 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
1279 |
137420800 |
|
|
219354164 |
lu3k |
E |
Aug. 17, 2023, 5:22 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
1294 |
136704000 |
|
|
219371272 |
Scalm |
E |
Aug. 17, 2023, 8:19 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
1310 |
136396800 |
|
|
219392026 |
bashunowant |
E |
Aug. 18, 2023, 3:11 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
1325 |
139468800 |
|
|
219354297 |
kotatsugame |
E |
Aug. 17, 2023, 5:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
1154 |
137011200 |
|
|
219355595 |
kondasujay2 |
E |
Aug. 17, 2023, 5:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
1154 |
137523200 |
|
|
219380824 |
lunchbox |
E |
Aug. 17, 2023, 11:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
1325 |
138854400 |
|
|
219401915 |
k1suxu |
E |
Aug. 18, 2023, 5:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
1668 |
284364800 |
|
|
219391518 |
Zeardoe |
E |
Aug. 18, 2023, 3:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
2184 |
142336000 |
|
|
219382398 |
Giga_Cronos |
E |
Aug. 18, 2023, 12:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
2184 |
283852800 |
|
|
219361347 |
thisiscaau |
E |
Aug. 17, 2023, 6:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
2433 |
11161600 |
|
|
219375259 |
camc |
E |
Aug. 17, 2023, 9:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
2573 |
144486400 |
|
|
219389713 |
Felix72 |
E |
Aug. 18, 2023, 2:34 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
3010 |
148377600 |
|
|
219353692 |
hamath |
E |
Aug. 17, 2023, 5:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
3369 |
285900800 |
|
|
219386448 |
tasnimbaq |
E |
Aug. 18, 2023, 1:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
342 |
2048000 |
|
|
219395459 |
K-423 |
E |
Aug. 18, 2023, 4:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
421 |
2150400 |
|
|
219358177 |
DmitryLzr |
E |
Aug. 17, 2023, 5:55 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
421 |
2150400 |
|
|
219348418 |
Tuanlinh123 |
E |
Aug. 17, 2023, 4:49 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
514 |
2150400 |
|
|
219395317 |
K-423 |
E |
Aug. 18, 2023, 3:59 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
670 |
2150400 |
|
|
219395217 |
K-423 |
E |
Aug. 18, 2023, 3:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
685 |
141619200 |
|
|
219347286 |
dreamoon_love_AA |
E |
Aug. 17, 2023, 4:44 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
951 |
137216000 |
|
|
219354763 |
olwvnnt |
E |
Aug. 17, 2023, 5:27 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
998 |
136806400 |
|
|
219354895 |
qwq7 |
E |
Aug. 17, 2023, 5:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
1013 |
136806400 |
|
|
219394488 |
_Linglin |
E |
Aug. 18, 2023, 3:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
1044 |
84992000 |
|
|
219351473 |
Dukkha |
E |
Aug. 17, 2023, 5:05 p.m. |
OK |
Java 17 |
TESTS |
27 |
1872 |
258969600 |
|
|
219359042 |
yuki_keshiki |
E |
Aug. 17, 2023, 6:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
3368 |
27750400 |
|
|
219400495 |
gardengnome |
E |
Aug. 18, 2023, 5:10 a.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
4663 |
221696000 |
|
|
219400278 |
gardengnome |
E |
Aug. 18, 2023, 5:07 a.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
4898 |
221388800 |
|
|
remove filters
Back to search problems