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 keyboard that consists of 26 keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter. You have to type the word s on this keyboard. It also consists only of lowercase Latin letters. To type a word, you need to type all its letters consecutively one by one. To type each letter you must position your hand exactly over the corresponding key and press it. Moving the hand between the keys takes time which is equal to the absolute value of the difference between positions of these keys (the keys are numbered from left to right). No time is spent on pressing the keys and on placing your hand over the first letter of the word. For example, consider a keyboard where the letters from 'a ' to 'z ' are arranged in consecutive alphabetical order. The letters 'h ', 'e ', 'l ' and 'o ' then are on the positions 8 , 5 , 12 and 15 , respectively. Therefore, it will take |5 - 8| + |12 - 5| + |12 - 12| + |15 - 12| = 13 units of time to type the word "hello". Determine how long it will take to print the word s . The first line contains an integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The next 2t lines contain descriptions of the test cases. The first line of a description contains a keyboard -- a string of length 26 , which consists only of lowercase Latin letters. Each of the letters from 'a ' to 'z ' appears exactly once on the keyboard. The second line of the description contains the word s . The word has a length from 1 to 50 letters inclusive and consists of lowercase Latin letters. Print t lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word s on the given keyboard. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
134147892 |
Gassa |
A |
Nov. 2, 2021, 7:18 p.m. |
OK |
D |
TESTS |
3 |
15 |
3379200 |
|
|
134145954 |
rahulshukla_12 |
A |
Nov. 2, 2021, 6:51 p.m. |
OK |
GNU C11 |
TESTS |
3 |
0 |
3686400 |
|
|
134134490 |
198r1a0488 |
A |
Nov. 2, 2021, 4:52 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
3686400 |
|
|
134135316 |
Pockerman20 |
A |
Nov. 2, 2021, 4:57 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
3686400 |
|
|
134160718 |
BugLeave |
A |
Nov. 3, 2021, 12:29 a.m. |
OK |
GNU C11 |
TESTS |
3 |
15 |
3686400 |
|
|
134164971 |
milan_s1 |
A |
Nov. 3, 2021, 2:36 a.m. |
OK |
GNU C11 |
TESTS |
3 |
15 |
3686400 |
|
|
134173109 |
rbl_p |
A |
Nov. 3, 2021, 4:35 a.m. |
OK |
GNU C11 |
TESTS |
3 |
15 |
3686400 |
|
|
134176209 |
123123ggg |
A |
Nov. 3, 2021, 5:23 a.m. |
OK |
GNU C11 |
TESTS |
3 |
15 |
3686400 |
|
|
134131847 |
G.Gopi_Krishna |
A |
Nov. 2, 2021, 4:37 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
3686400 |
|
|
134132087 |
yonezukenshi |
A |
Nov. 2, 2021, 4:38 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
3686400 |
|
|
134133865 |
brox712 |
A |
Nov. 2, 2021, 4:48 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
3686400 |
|
|
134147018 |
TRR |
A |
Nov. 2, 2021, 7:05 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134146340 |
carre |
A |
Nov. 2, 2021, 6:56 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134177891 |
fytftyf |
A |
Nov. 3, 2021, 5:46 a.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134173923 |
7muyi |
A |
Nov. 3, 2021, 4:48 a.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134167230 |
ZHONGRYOU |
A |
Nov. 3, 2021, 3:29 a.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134164300 |
himanshu1431 |
A |
Nov. 3, 2021, 2:20 a.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134160729 |
Rainer1116 |
A |
Nov. 3, 2021, 12:30 a.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134160683 |
Chinese_zjc_ |
A |
Nov. 3, 2021, 12:28 a.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134157868 |
Yami27 |
A |
Nov. 2, 2021, 10:42 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134157384 |
B962006 |
A |
Nov. 2, 2021, 10:26 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
1024000 |
|
|
134178036 |
lys1280023 |
A |
Nov. 3, 2021, 5:48 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134176337 |
pratikpz |
A |
Nov. 3, 2021, 5:25 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134172650 |
kougunin |
A |
Nov. 3, 2021, 4:27 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134172411 |
njk007 |
A |
Nov. 3, 2021, 4:23 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134169165 |
shakilsustswe |
A |
Nov. 3, 2021, 4:14 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134167653 |
Profat_ |
A |
Nov. 3, 2021, 3:39 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134167552 |
nihalshahria |
A |
Nov. 3, 2021, 3:37 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134166940 |
Dream_to |
A |
Nov. 3, 2021, 3:23 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134166785 |
china_boy |
A |
Nov. 3, 2021, 3:20 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134164570 |
Applouz |
A |
Nov. 3, 2021, 2:27 a.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
1024000 |
|
|
134175008 |
echo79 |
A |
Nov. 3, 2021, 5:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134177658 |
rgnerdplayer |
A |
Nov. 3, 2021, 5:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134174978 |
kwee |
A |
Nov. 3, 2021, 5:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134174432 |
IHSAN_NAHID |
A |
Nov. 3, 2021, 4:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134174035 |
Anant_8323 |
A |
Nov. 3, 2021, 4:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134169222 |
midu_01 |
A |
Nov. 3, 2021, 4:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134167476 |
atarax |
A |
Nov. 3, 2021, 3:35 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134166422 |
RyanSohYZ |
A |
Nov. 3, 2021, 3:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134164156 |
Jorge213 |
A |
Nov. 3, 2021, 2:17 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134161470 |
Ameliorate |
A |
Nov. 3, 2021, 12:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134148484 |
HeatoM |
A |
Nov. 2, 2021, 7:26 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134154503 |
YousefShereen |
A |
Nov. 2, 2021, 9:10 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134157146 |
guperman |
A |
Nov. 2, 2021, 10:19 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134158738 |
haru_101 |
A |
Nov. 2, 2021, 11:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134160391 |
NooB_NO_1 |
A |
Nov. 3, 2021, 12:19 a.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134161160 |
Hoppz |
A |
Nov. 3, 2021, 12:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134166731 |
ybyxb |
A |
Nov. 3, 2021, 3:19 a.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134173093 |
yashagg1329 |
A |
Nov. 3, 2021, 4:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134175259 |
alif_cse_ju |
A |
Nov. 3, 2021, 5:09 a.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134179183 |
imtiyazrasool92 |
A |
Nov. 3, 2021, 6:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
1228800 |
|
|
134159761 |
ing.camilovarela |
A |
Nov. 2, 2021, 11:55 p.m. |
OK |
Go |
TESTS |
3 |
186 |
8192000 |
|
|
134159590 |
bavian |
A |
Nov. 2, 2021, 11:48 p.m. |
OK |
Go |
TESTS |
3 |
186 |
8192000 |
|
|
134137772 |
XGptw |
A |
Nov. 2, 2021, 5:18 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
24576000 |
|
|
134125057 |
ameh |
A |
Nov. 2, 2021, 4:23 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
24576000 |
|
|
134175458 |
unfixedbug |
A |
Nov. 3, 2021, 5:12 a.m. |
OK |
Java 11 |
TESTS |
3 |
171 |
24678400 |
|
|
134137598 |
dhruvil_01 |
A |
Nov. 2, 2021, 5:17 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
24678400 |
|
|
134129915 |
amithpaavan |
A |
Nov. 2, 2021, 4:33 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
24678400 |
|
|
134124977 |
Sachin_6 |
A |
Nov. 2, 2021, 4:23 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
24678400 |
|
|
134162154 |
syam.kumar |
A |
Nov. 3, 2021, 1:16 a.m. |
OK |
Java 11 |
TESTS |
3 |
171 |
24780800 |
|
|
134152647 |
samarpitsachan091 |
A |
Nov. 2, 2021, 8:34 p.m. |
OK |
Java 11 |
TESTS |
3 |
186 |
24576000 |
|
|
134137203 |
RISHI_RAJ_SINGH |
A |
Nov. 2, 2021, 5:13 p.m. |
OK |
Java 11 |
TESTS |
2 |
186 |
24576000 |
|
|
134141591 |
solo07 |
A |
Nov. 2, 2021, 5:57 p.m. |
OK |
Java 11 |
TESTS |
3 |
187 |
24473600 |
|
|
134136020 |
kocko |
A |
Nov. 2, 2021, 5:03 p.m. |
OK |
Java 8 |
TESTS |
2 |
77 |
18841600 |
|
|
134179261 |
darvesh_23 |
A |
Nov. 3, 2021, 6:04 a.m. |
OK |
Java 8 |
TESTS |
3 |
78 |
18841600 |
|
|
134176593 |
Vishnu750 |
A |
Nov. 3, 2021, 5:29 a.m. |
OK |
Java 8 |
TESTS |
3 |
93 |
18739200 |
|
|
134163718 |
201502010200 |
A |
Nov. 3, 2021, 2:04 a.m. |
OK |
Java 8 |
TESTS |
3 |
93 |
18841600 |
|
|
134125088 |
honeysingh18 |
A |
Nov. 2, 2021, 4:23 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
18841600 |
|
|
134124942 |
Piyushnagpal80 |
A |
Nov. 2, 2021, 4:23 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
18841600 |
|
|
134145645 |
anand_a3b |
A |
Nov. 2, 2021, 6:47 p.m. |
OK |
Java 8 |
TESTS |
3 |
93 |
18944000 |
|
|
134144967 |
anand_a3b |
A |
Nov. 2, 2021, 6:38 p.m. |
OK |
Java 8 |
TESTS |
3 |
93 |
18944000 |
|
|
134177360 |
manan29 |
A |
Nov. 3, 2021, 5:39 a.m. |
OK |
Java 8 |
TESTS |
3 |
93 |
19046400 |
|
|
134146642 |
Mustafa__ |
A |
Nov. 2, 2021, 7 p.m. |
OK |
Java 8 |
TESTS |
3 |
108 |
18739200 |
|
|
134178963 |
noisegain |
A |
Nov. 3, 2021, 6 a.m. |
OK |
Kotlin 1.5 |
TESTS |
3 |
202 |
25190400 |
|
|
134153516 |
Flyheck |
A |
Nov. 2, 2021, 8:50 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
0 |
1126400 |
|
|
134151125 |
Don4ik |
A |
Nov. 2, 2021, 8:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
0 |
1126400 |
|
|
134140087 |
043_kishan |
A |
Nov. 2, 2021, 5:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
0 |
1126400 |
|
|
134134739 |
MAYIPLEASE |
A |
Nov. 2, 2021, 4:53 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
0 |
1126400 |
|
|
134134594 |
vierlai |
A |
Nov. 2, 2021, 4:52 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
0 |
1126400 |
|
|
134173305 |
bkifhr9 |
A |
Nov. 3, 2021, 4:38 a.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
0 |
3174400 |
|
|
134174918 |
StevenTran0410 |
A |
Nov. 3, 2021, 5:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
15 |
1126400 |
|
|
134160542 |
Jie0355 |
A |
Nov. 3, 2021, 12:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
15 |
1126400 |
|
|
134155708 |
kokobaghdad123 |
A |
Nov. 2, 2021, 9:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
15 |
1126400 |
|
|
134135492 |
Anastasia1605 |
A |
Nov. 2, 2021, 4:59 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
15 |
1126400 |
|
|
134132218 |
Grapeee |
A |
Nov. 2, 2021, 4:39 p.m. |
OK |
Node.js |
TESTS |
2 |
93 |
14540800 |
|
|
134169167 |
travisluong |
A |
Nov. 3, 2021, 4:14 a.m. |
OK |
PyPy 2 |
TESTS |
3 |
62 |
22425600 |
|
|
134161923 |
wolfram_ |
A |
Nov. 3, 2021, 1:09 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
108 |
19865600 |
|
|
134154642 |
lebron87 |
A |
Nov. 2, 2021, 9:13 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
108 |
20377600 |
|
|
134174021 |
BingHa |
A |
Nov. 3, 2021, 4:50 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
108 |
20889600 |
|
|
134167137 |
rahin1301 |
A |
Nov. 3, 2021, 3:27 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
108 |
21913600 |
|
|
134167518 |
IceKnight1093 |
A |
Nov. 3, 2021, 3:36 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
108 |
23040000 |
|
|
134168449 |
yugant196 |
A |
Nov. 3, 2021, 3:57 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
139 |
22528000 |
|
|
134160218 |
whatshisbucket |
A |
Nov. 3, 2021, 12:12 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
139 |
22528000 |
|
|
134179067 |
aman_xoxo |
A |
Nov. 3, 2021, 6:01 a.m. |
OK |
PyPy 3 |
TESTS |
3 |
139 |
22732800 |
|
|
134138691 |
TogrulAsadov |
A |
Nov. 2, 2021, 5:28 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
139 |
23040000 |
|
|
134146759 |
SatishBehera_28 |
A |
Nov. 2, 2021, 7:02 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
140 |
22630400 |
|
|
134154133 |
iambabo |
A |
Nov. 2, 2021, 9:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
77 |
33177600 |
|
|
134131730 |
one_step_away |
A |
Nov. 2, 2021, 4:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
78 |
32665600 |
|
|
134148805 |
b3ck3rz |
A |
Nov. 2, 2021, 7:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
93 |
35737600 |
|
|
134167665 |
dutt_shouvik |
A |
Nov. 3, 2021, 3:39 a.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
93 |
162918400 |
|
|
134149727 |
feelme |
A |
Nov. 2, 2021, 7:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
109 |
34611200 |
|
|
134136010 |
tyzzi |
A |
Nov. 2, 2021, 5:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
124 |
34406400 |
|
|
134142512 |
sejalace7 |
A |
Nov. 2, 2021, 6:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
124 |
34713600 |
|
|
134178485 |
jwo29 |
A |
Nov. 3, 2021, 5:53 a.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
124 |
36966400 |
|
|
134136746 |
freakbuoyancy |
A |
Nov. 2, 2021, 5:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
124 |
38092800 |
|
|
134132212 |
Skillful_Wanderer |
A |
Nov. 2, 2021, 4:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
139 |
35225600 |
|
|
134148829 |
OLOGY |
A |
Nov. 2, 2021, 7:32 p.m. |
OK |
Python 2 |
TESTS |
3 |
31 |
3993600 |
|
|
134147685 |
IceFire |
A |
Nov. 2, 2021, 7:15 p.m. |
OK |
Python 3 |
TESTS |
3 |
31 |
4505600 |
|
|
134175584 |
Tparsa |
A |
Nov. 3, 2021, 5:14 a.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134174710 |
Muhammad_mhs |
A |
Nov. 3, 2021, 5:01 a.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134172354 |
Sravanmsk |
A |
Nov. 3, 2021, 4:22 a.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134153995 |
Mivs |
A |
Nov. 2, 2021, 8:59 p.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134153944 |
Mivs |
A |
Nov. 2, 2021, 8:58 p.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134153858 |
Mivs |
A |
Nov. 2, 2021, 8:56 p.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134151594 |
BlackPanther112358 |
A |
Nov. 2, 2021, 8:17 p.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134149038 |
satishcrazy |
A |
Nov. 2, 2021, 7:35 p.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134141923 |
TheOtherOne |
A |
Nov. 2, 2021, 6 p.m. |
OK |
Python 3 |
TESTS |
3 |
46 |
4505600 |
|
|
134159807 |
Spheniscine |
A |
Nov. 2, 2021, 11:57 p.m. |
OK |
Rust |
TESTS |
3 |
15 |
1331200 |
|
|
134167112 |
kobae964 |
A |
Nov. 3, 2021, 3:27 a.m. |
OK |
Rust |
TESTS |
3 |
15 |
1843200 |
|
|
remove filters
Back to search problems