Educational Codeforces Round 178 (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
2104 Educational Codeforces Round 178 (Rated for Div. 2) FINISHED False 7200 30554723 April 28, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 8005 ) E Unpleasant Strings PROGRAMMING binary search data structures dp greedy strings

Let's call a letter allowed if it is a lowercase letter and is one of the first (k) letters of the Latin alphabet. You are given a string (s) of length (n), consisting only of allowed letters. Let's call a string (t) pleasant if (t) is a subsequence of (s). You are given (q) strings (t_1, t_2, \dots, t_q). All of them consist only of allowed letters. For each string (t_i), calculate the minimum number of allowed letters you need to append to it on the right so that it stops being pleasant. A sequence (t) is a subsequence of a sequence (s) if (t) can be obtained from (s) by the deletion of several (possibly, zero or all) element from arbitrary positions. The first line contains two integers (n) and (k) ((1 \le n \le 10^6); (1 \le k \le 26)) — the length of the string (s) and the number of allowed letters. The second line contains the string (s), consisting of (n) lowercase Latin letters. Each character of the string is one of the first (k) letters of the Latin alphabet. The third line contains one integer (q) ((1 \le q \le 2 \cdot 10^5)) — the number of queries. The next (q) lines contain queries: one query per line. The (i)-th line contains the string (t_i), consisting only of allowed letters. Additional constraint on input: the total length of all (t_i) does not exceed (10^6). For each query, output one integer — the minimum number of allowed letters that need to be appended to the string on the right so that it stops being pleasant. In the first example: The string cc is already unpleasant, so nothing needs to be appended to it; bcb is pleasant, so at least one letter needs to be appended to the right: bcba will not work, but bcbb and bcbc are unpleasant. To b , at least two letters need to be appended, since ba , bb , and bc are pleasant. For example, we can obtain an unpleasant string bbb .

Tutorials

Educational Codeforces Round 178 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317646150 antofik E April 28, 2025, 4:20 p.m. OK C# 10 TESTS 28 656 155238400
317657085 alpha1215 E April 28, 2025, 5:22 p.m. OK C++17 (GCC 7-32) TESTS 28 140 11878400
317655537 A1exandruAI E April 28, 2025, 5:11 p.m. OK C++17 (GCC 7-32) TESTS 28 140 11878400
317657022 Koishii E April 28, 2025, 5:22 p.m. OK C++17 (GCC 7-32) TESTS 28 140 11980800
317668198 HG010 E April 28, 2025, 7:13 p.m. OK C++17 (GCC 7-32) TESTS 28 155 11776000
317652526 play_machine E April 28, 2025, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 28 155 11878400
317644129 woralem23 E April 28, 2025, 4:15 p.m. OK C++17 (GCC 7-32) TESTS 28 155 11980800
317643860 hyenje29 E April 28, 2025, 4:15 p.m. OK C++17 (GCC 7-32) TESTS 28 155 12083200
317671367 zhouxiuoa E April 28, 2025, 7:50 p.m. OK C++17 (GCC 7-32) TESTS 28 155 110284800
317670576 zhouxiuoa E April 28, 2025, 7:39 p.m. OK C++17 (GCC 7-32) TESTS 28 155 110284800
317641886 morshaline_1 E April 28, 2025, 4:10 p.m. OK C++17 (GCC 7-32) TESTS 28 156 11980800
317666073 Ayanokoji7 E April 28, 2025, 6:50 p.m. OK C++20 (GCC 13-64) TESTS 28 109 7372800
317696534 fanhuaxingyu E April 29, 2025, 5:18 a.m. OK C++20 (GCC 13-64) TESTS 28 109 11366400
317691908 Nady_ E April 29, 2025, 3:55 a.m. OK C++20 (GCC 13-64) TESTS 28 109 11673600
317666704 Senku E April 28, 2025, 6:57 p.m. OK C++20 (GCC 13-64) TESTS 28 109 16691200
317692675 3017 E April 29, 2025, 4:10 a.m. OK C++20 (GCC 13-64) TESTS 28 109 23244800
317684760 leandro_pina E April 29, 2025, 1:10 a.m. OK C++20 (GCC 13-64) TESTS 28 109 23244800
317666862 barrybonds E April 28, 2025, 6:59 p.m. OK C++20 (GCC 13-64) TESTS 28 109 25702400
317644151 inkvizytor E April 28, 2025, 4:15 p.m. OK C++20 (GCC 13-64) TESTS 28 124 3379200
317659428 Yaoyao123456 E April 28, 2025, 5:43 p.m. OK C++20 (GCC 13-64) TESTS 28 124 7372800
317667656 Kalashyan E April 28, 2025, 7:07 p.m. OK C++20 (GCC 13-64) TESTS 28 124 11468800
317699538 Sakura_Love E April 29, 2025, 5:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 109 4096000
317698940 AIpha_Q E April 29, 2025, 5:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 109 8499200
317659476 autoastt E April 28, 2025, 5:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 109 11468800
317676306 _Dr_Baraa E April 28, 2025, 9:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 109 11673600
317674305 -CHUNU- E April 28, 2025, 8:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 124 3481600
317645982 FelixBin E April 28, 2025, 4:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 124 3481600
317698510 AIpha_Q E April 29, 2025, 5:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 124 8499200
317676735 SalsaShark E April 28, 2025, 9:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 124 10547200
317672590 Sedulous123 E April 28, 2025, 8:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 124 11366400
317659524 Royboy01 E April 28, 2025, 5:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 28 124 11468800
317677626 NenadDapic E April 28, 2025, 9:44 p.m. OK FPC TESTS 28 436 109977600
317641867 pengin_2000 E April 28, 2025, 4:10 p.m. OK GNU C11 TESTS 28 218 110387200
317696701 muradbhai E April 29, 2025, 5:20 a.m. OK GNU C11 TESTS 28 952 110284800
317665704 rainboy E April 28, 2025, 6:44 p.m. OK GNU C11 TESTS 28 983 109260800
317647120 METASEKOIA E April 28, 2025, 4:23 p.m. OK Go TESTS 28 889 259481600
317649813 rakshit2611 E April 28, 2025, 4:29 p.m. OK Java 21 TESTS 28 749 49254400
317641589 nhant E April 28, 2025, 4:09 p.m. OK Java 21 TESTS 28 750 9318400
317693018 jogojo E April 29, 2025, 4:16 a.m. OK Java 21 TESTS 28 842 160051200
317642500 CodeMuni E April 28, 2025, 4:11 p.m. OK Java 21 TESTS 28 999 154214400
317655849 RahulAhuja2901 E April 28, 2025, 5:13 p.m. OK Java 21 TESTS 28 1046 48742400
317645351 meteoLdrago E April 28, 2025, 4:18 p.m. OK Java 21 TESTS 28 1093 214323200
317687067 man-ray E April 29, 2025, 2:10 a.m. OK Java 21 TESTS 28 1233 532172800
317649464 mayur_shende E April 28, 2025, 4:28 p.m. OK Java 21 TESTS 28 1296 50688000
317644342 Karish29 E April 28, 2025, 4:16 p.m. OK Java 21 TESTS 28 1390 240435200
317660875 Yousef_Badr E April 28, 2025, 5:55 p.m. OK Java 21 TESTS 28 1452 122982400
317675688 huhansan E April 28, 2025, 9:01 p.m. OK Java 8 TESTS 28 937 259379200
317645792 parad512 E April 28, 2025, 4:19 p.m. OK Java 8 TESTS 28 968 254361600
317661137 a155b55 E April 28, 2025, 5:57 p.m. OK Java 8 TESTS 28 1015 231833600
317694376 CodeBharat E April 29, 2025, 4:43 a.m. OK PyPy 3-64 TESTS 28 546 25600000
317643875 donghyeon E April 28, 2025, 4:15 p.m. OK PyPy 3-64 TESTS 28 546 44032000
317670339 Om_Singh_ E April 28, 2025, 7:37 p.m. OK PyPy 3-64 TESTS 28 577 45363200
317671266 Om_Singh_ E April 28, 2025, 7:48 p.m. OK PyPy 3-64 TESTS 28 577 45465600
317641910 FikreyohanesAbera E April 28, 2025, 4:10 p.m. OK PyPy 3-64 TESTS 28 608 50790400
317641795 abhinavnayak21 E April 28, 2025, 4:09 p.m. OK PyPy 3-64 TESTS 28 640 64000000
317683847 yassinearfaoui131 ayyoub.mkadmi3 E April 29, 2025, 12:43 a.m. OK PyPy 3-64 TESTS 28 671 45260800
317649298 Banquo E April 28, 2025, 4:28 p.m. OK PyPy 3-64 TESTS 28 687 44851200
317642808 Erito E April 28, 2025, 4:12 p.m. OK PyPy 3-64 TESTS 28 687 71372800
317649979 iska_terminator E April 28, 2025, 4:30 p.m. OK PyPy 3-64 TESTS 28 702 41984000
317669927 vstiff E April 28, 2025, 7:32 p.m. OK Rust 2021 TESTS 28 234 214016000
317662290 DreadedHippy E April 28, 2025, 6:08 p.m. OK Rust 2021 TESTS 28 593 20889600
317661591 justOneStep E April 28, 2025, 6:01 p.m. OK Rust 2021 TESTS 28 749 271974400
317641901 justOneStep E April 28, 2025, 4:10 p.m. OK Rust 2021 TESTS 28 999 512204800

remove filters

Back to search problems