Educational Codeforces Round 60 (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
1117 Educational Codeforces Round 60 (Rated for Div. 2) FINISHED False 7200 181318799 Feb. 18, 2019, 3:40 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 585 ) F Crisp String PROGRAMMING bitmasks dp 2600

B'You are given a string of length n . Each character is one of the first p lowercase Latin letters. You are also given a matrix A with binary values of size p x p . This matrix is symmetric ( A_{ij} = A_{ji} ). A_{ij} = 1 means that the string can have the i -th and j -th letters of Latin alphabet adjacent. Let 's call the string crisp if all of the adjacent characters in it can be adjacent (have 1 in the corresponding cell of matrix A ). You are allowed to do the following move. Choose any letter, remove all its occurrences and join the remaining parts of the string without changing their order. For example, removing letter 'a ' from "abacaba" will yield "bcb". The string you are given is crisp. The string should remain crisp after every move you make. You are allowed to do arbitrary number of moves (possible zero). What is the shortest resulting string you can obtain? The first line contains two integers n and p ( 1 <= n <= 10^5 , 1 <= p <= 17 ) -- the length of the initial string and the length of the allowed prefix of Latin alphabet. The second line contains the initial string. It is guaranteed that it contains only first p lowercase Latin letters and that is it crisp. Some of these p first Latin letters might not be present in the string. Each of the next p lines contains p integer numbers -- the matrix A ( 0 <= A_{ij} <= 1 , A_{ij} = A_{ji} ). A_{ij} = 1 means that the string can have the i -th and j -th letters of Latin alphabet adjacent. Print a single integer -- the length of the shortest string after you make arbitrary number of moves (possible zero). In the first example no letter can be removed from the initial string. In the second example you can remove letters in order: 'b ', 'c ', 'a '. The strings on the intermediate steps will be: "abacaba" rightarrow "aacaa" rightarrow "aaaa" rightarrow "'...

Tutorials

65365

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
50128217 sokolovivan F Feb. 18, 2019, 5:23 p.m. OK GNU C++11 TESTS 68 46 307200 2600
69841943 cmwqf F Jan. 30, 2020, 1:23 p.m. OK GNU C++11 TESTS 68 46 819200 2600
69610787 AnnieCai F Jan. 27, 2020, 11:25 a.m. OK GNU C++11 TESTS 68 46 1536000 2600
53116724 mmmod_lqs F April 22, 2019, 8:37 a.m. OK GNU C++11 TESTS 68 46 3686400 2600
50122434 MZuev F Feb. 18, 2019, 4:49 p.m. OK GNU C++11 TESTS 68 77 10240000 2600
50156199 Gloid F Feb. 19, 2019, 10:13 a.m. OK GNU C++11 TESTS 68 93 1228800 2600
50694307 guille F March 2, 2019, 5:17 p.m. OK GNU C++11 TESTS 68 93 10035200 2600
50530159 maxtir F Feb. 26, 2019, 1:20 p.m. OK GNU C++11 TESTS 68 109 1433600 2600
56413986 luogu_bot4 F July 2, 2019, 2:59 a.m. OK GNU C++11 TESTS 68 109 11980800 2600
50199684 perchema F Feb. 19, 2019, 4:59 p.m. OK GNU C++11 TESTS 68 109 45977600 2600
66544927 kazuma F Dec. 9, 2019, 12:53 p.m. OK GNU C++14 TESTS 68 61 10752000 2600
50413659 sdnr1 F Feb. 24, 2019, 5:06 a.m. OK GNU C++14 TESTS 68 62 10137600 2600
50157640 Cache F Feb. 19, 2019, 11 a.m. OK GNU C++14 TESTS 68 77 6144000 2600
50214300 Mushegh F Feb. 20, 2019, 3:07 a.m. OK GNU C++14 TESTS 68 93 19865600 2600
50674410 gyz_gyz F March 2, 2019, 8:34 a.m. OK GNU C++14 TESTS 68 93 38809600 2600
50141269 shoemakerjo F Feb. 18, 2019, 10:12 p.m. OK GNU C++14 TESTS 68 124 1843200 2600
69880019 Mackerel_Pike F Jan. 31, 2020, 5:59 a.m. OK GNU C++14 TESTS 68 124 3276800 2600
51315506 schtomi97 F March 14, 2019, 11:36 p.m. OK GNU C++14 TESTS 68 124 3993600 2600
50122418 danya.smelskiy F Feb. 18, 2019, 4:49 p.m. OK GNU C++14 TESTS 68 124 27750400 2600
50157627 m4h F Feb. 19, 2019, 11 a.m. OK GNU C++14 TESTS 68 139 512000 2600
50126982 IDKWNTC F Feb. 18, 2019, 5:16 p.m. OK GNU C++17 TESTS 68 31 409600 2600
52550973 AkramKhan F April 10, 2019, 4:17 a.m. OK GNU C++17 TESTS 68 46 3993600 2600
50223773 bert30702 F Feb. 20, 2019, 6:22 a.m. OK GNU C++17 TESTS 68 46 4608000 2600
52550939 AkramKhan F April 10, 2019, 4:14 a.m. OK GNU C++17 TESTS 68 46 27955200 2600
52550919 AkramKhan F April 10, 2019, 4:12 a.m. OK GNU C++17 TESTS 68 46 32051200 2600
52550866 AkramKhan F April 10, 2019, 4:08 a.m. OK GNU C++17 TESTS 68 61 111411200 2600
57067264 dragonslayerintraining F July 14, 2019, 11:03 p.m. OK GNU C++17 TESTS 68 62 1638400 2600
66535735 vjudge1 F Dec. 9, 2019, 9:32 a.m. OK GNU C++17 TESTS 68 62 10752000 2600
50461191 neal F Feb. 24, 2019, 5:42 p.m. OK GNU C++17 TESTS 68 77 2867200 2600
50344275 cjnwq F Feb. 23, 2019, 5:23 a.m. OK GNU C++17 TESTS 68 77 18739200 2600
50127140 uwi F Feb. 18, 2019, 5:17 p.m. OK Java 8 TESTS 68 202 0 2600
66397613 dalt F Dec. 6, 2019, 11:20 a.m. OK Java 8 TESTS 68 202 48537600 2600
50623354 Oopsimbad F March 1, 2019, 3:57 a.m. OK Java 8 TESTS 68 546 0 2600
50294153 PrakharJain F Feb. 21, 2019, 7:16 p.m. OK Java 8 TESTS 68 577 35942400 2600
50127130 niyaznigmatul F Feb. 18, 2019, 5:16 p.m. OK Java 8 TESTS 68 655 39116800 2600
50259287 I_love_Harpae F Feb. 20, 2019, 10:09 p.m. OK Java 8 TESTS 68 826 66560000 2600
51273640 spar5h F March 13, 2019, 7:29 p.m. OK Java 8 TESTS 68 1138 135475200 2600
50156840 r57shell F Feb. 19, 2019, 10:35 a.m. OK MS C++ TESTS 68 171 9011200 2600
51609973 CountZero F March 21, 2019, 9:46 a.m. OK Rust TESTS 68 327 8396800 2600
50547637 Veladus F Feb. 26, 2019, 11:27 p.m. OK Rust TESTS 68 810 3891200 2600

remove filters

Back to search problems