Educational Codeforces Round 74 (Rated for Div. 2)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1238 Educational Codeforces Round 74 (Rated for Div. 2) FINISHED False 8400 166893887 Oct. 8, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3132 ) E Keyboard Purchase PROGRAMMING bitmasks dp 2200

B'You have a password which you often type -- a string s of length n . Every character of this string is one of the first m lowercase Latin letters. Since you spend a lot of time typing it, you want to buy a new keyboard. A keyboard is a permutation of the first m Latin letters. For example, if m = 3 , then there are six possible keyboards: abc, acb, bac, bca, cab and cba. Since you type your password with one finger, you need to spend time moving your finger from one password character to the next. The time to move from character s_i to character s_{i+1} is equal to the distance between these characters on keyboard. The total time you have to spend typing the password with a keyboard is called the slowness of this keyboard. More formaly, the slowness of keyboard is equal to sum limits_{i=2}^{n} |pos_{s_{i-1}} - pos_{s_i} | , where pos_x is position of letter x in keyboard. For example, if s is aacabc and the keyboard is bac, then the total time of typing this password is |pos_a - pos_a| + |pos_a - pos_c| + |pos_c - pos_a| + |pos_a - pos_b| + |pos_b - pos_c| = |2 - 2| + |2 - 3| + |3 - 2| + |2 - 1| + |1 - 3| = 0 + 1 + 1 + 1 + 2 = 5 . Before buying a new keyboard you want to know the minimum possible slowness that the keyboard can have. The first line contains two integers n and m ( 1 <= n <= 10^5, 1 <= m <= 20 ). The second line contains the string s consisting of n characters. Each character is one of the first m Latin letters (lowercase). Print one integer xe2 x80 x93 the minimum slowness a keyboard can have. The first test case is considered in the statement. In the second test case the slowness of any keyboard is 0 . In the third test case one of the most suitable keyboards is bacd. '...

Tutorials

Educational Codeforces Round 74 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
62144852 Apollochen E Oct. 8, 2019, 4:01 p.m. OK GNU C++11 TESTS 23 93 12697600 2200
62155054 LYYY E Oct. 8, 2019, 4:50 p.m. OK GNU C++11 TESTS 23 140 10035200 2200
62152573 shurongwang E Oct. 8, 2019, 4:38 p.m. OK GNU C++11 TESTS 23 140 117760000 2200
62137901 YaoQi E Oct. 8, 2019, 3:33 p.m. OK GNU C++11 TESTS 23 155 109158400 2200
62138771 I_love_Nikaidou_Shinku E Oct. 8, 2019, 3:37 p.m. OK GNU C++11 TESTS 23 156 96768000 2200
62151687 llyc E Oct. 8, 2019, 4:33 p.m. OK GNU C++11 TESTS 23 170 96768000 2200
62142043 aa2985759 E Oct. 8, 2019, 3:50 p.m. OK GNU C++11 TESTS 23 171 93286400 2200
62135674 xjd0623 E Oct. 8, 2019, 3:26 p.m. OK GNU C++11 TESTS 23 187 160460800 2200
62134678 danya090699 E Oct. 8, 2019, 3:22 p.m. OK GNU C++11 TESTS 23 202 88371200 2200
62143011 RedNextCentury E Oct. 8, 2019, 3:54 p.m. OK GNU C++11 TESTS 23 202 103219200 2200
62130371 HIR180 E Oct. 8, 2019, 3:01 p.m. OK GNU C++14 TESTS 23 109 8704000 2200
62149206 little_misfortune E Oct. 8, 2019, 4:22 p.m. OK GNU C++14 TESTS 23 139 92569600 2200
62141843 beginend E Oct. 8, 2019, 3:49 p.m. OK GNU C++14 TESTS 23 139 113561600 2200
62141807 Navick E Oct. 8, 2019, 3:49 p.m. OK GNU C++14 TESTS 23 140 8704000 2200
62135843 DimmyT E Oct. 8, 2019, 3:26 p.m. OK GNU C++14 TESTS 23 140 67481600 2200
62142809 liouzhou_101 E Oct. 8, 2019, 3:53 p.m. OK GNU C++14 TESTS 23 155 8806400 2200
62126207 boboniu E Oct. 8, 2019, 2:45 p.m. OK GNU C++14 TESTS 23 155 8806400 2200
62147661 misael E Oct. 8, 2019, 4:14 p.m. OK GNU C++14 TESTS 23 171 126361600 2200
62137000 ZZZZZZZZZZZZZZZZZZ E Oct. 8, 2019, 3:30 p.m. OK GNU C++14 TESTS 23 187 4198400 2200
62138899 ZZZZZZZZZZZZZZZZZZ E Oct. 8, 2019, 3:37 p.m. OK GNU C++14 TESTS 23 187 5222400 2200
62150696 AkazawaShion E Oct. 8, 2019, 4:29 p.m. OK GNU C++17 TESTS 23 140 9932800 2200
62142349 Liah0530 E Oct. 8, 2019, 3:51 p.m. OK GNU C++17 TESTS 23 140 109363200 2200
62138707 jiangly E Oct. 8, 2019, 3:36 p.m. OK GNU C++17 TESTS 23 171 88780800 2200
62150355 csegura E Oct. 8, 2019, 4:27 p.m. OK GNU C++17 TESTS 23 187 4505600 2200
62150370 Antygenius E Oct. 8, 2019, 4:27 p.m. OK GNU C++17 TESTS 23 187 21094400 2200
62139465 SangSangDoMotHanJungChe E Oct. 8, 2019, 3:39 p.m. OK GNU C++17 TESTS 23 187 92569600 2200
62136503 Sparky123 E Oct. 8, 2019, 3:28 p.m. OK GNU C++17 TESTS 23 187 96972800 2200
62129204 blackbori E Oct. 8, 2019, 2:57 p.m. OK GNU C++17 TESTS 23 187 110592000 2200
62131237 KrK E Oct. 8, 2019, 3:05 p.m. OK GNU C++17 TESTS 23 202 16896000 2200
62142446 cerberus97 E Oct. 8, 2019, 3:51 p.m. OK GNU C++17 TESTS 23 202 96972800 2200
62141353 AleksanderBalobanov E Oct. 8, 2019, 3:47 p.m. OK MS C++ 2017 TESTS 23 265 201932800 2200
62153450 Friska E Oct. 8, 2019, 4:42 p.m. OK MS C++ 2017 TESTS 23 904 19865600 2200
62147131 sansen E Oct. 8, 2019, 4:12 p.m. OK Rust TESTS 23 171 17817600 2200

remove filters

Back to search problems