Codeforces Round 750 (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
1582 Codeforces Round 750 (Div. 2) FINISHED False 9000 102110063 Oct. 24, 2021, 10:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 16548 ) C Grandma Capa Knits a Scarf PROGRAMMING data structures greedy strings two pointers

B"Grandma Capa has decided to knit a scarf and asked Grandpa Sher to make a pattern for it, a pattern is a string consisting of lowercase English letters. Grandpa Sher wrote a string s of length n . Grandma Capa wants to knit a beautiful scarf, and in her opinion, a beautiful scarf can only be knit from a string that is a palindrome. She wants to change the pattern written by Grandpa Sher, but to avoid offending him, she will choose one lowercase English letter and erase some (at her choice, possibly none or all) occurrences of that letter in string s . She also wants to minimize the number of erased symbols from the pattern. Please help her and find the minimum number of symbols she can erase to make string s a palindrome, or tell her that it's impossible. Notice that she can only erase symbols equal to the one letter she chose. A string is a palindrome if it is the same from the left to the right and from the right to the left. For example, the strings 'kek', 'abacaba', 'r' and 'papicipap' are palindromes, while the strings 'abb' and 'iq' are not. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. The next 2 cdot t lines contain the description of test cases. The description of each test case consists of two lines. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the string. The second line of each test case contains the string s consisting of n lowercase English letters. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case print the minimum number of erased symbols required to make the string a palindrome, if it is possible, and -1 , if it is impossible. In the first test case, you can choose a letter 'a' and erase its first and last occurrences, you will get a string 'bcaacb', which is a palindrome. You can also choose a letter 'b' and "...

Tutorials

Codeforces Round #750 (Div.2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
132952549 rainboy C Oct. 24, 2021, 5:51 p.m. OK GNU C11 TESTS 31 15 3788800
132972337 Youarenotgood C Oct. 25, 2021, 2:42 a.m. OK GNU C11 TESTS 31 15 3788800
132938112 hritikritesh C Oct. 24, 2021, 2:43 p.m. OK GNU C11 TESTS 31 15 3891200
132938969 Mrgglock C Oct. 24, 2021, 2:51 p.m. OK GNU C11 TESTS 31 30 3788800
132971240 CCSU_Cola C Oct. 25, 2021, 2:09 a.m. OK GNU C++14 TESTS 31 15 1126400
132968561 iterater C Oct. 25, 2021, 12:30 a.m. OK GNU C++14 TESTS 31 15 1126400
132968550 srt20050822 C Oct. 25, 2021, 12:29 a.m. OK GNU C++14 TESTS 31 15 1126400
132979598 yateng817 C Oct. 25, 2021, 5:16 a.m. OK GNU C++14 TESTS 31 15 1126400
132974335 bkifhr10 C Oct. 25, 2021, 3:29 a.m. OK GNU C++14 TESTS 31 15 1126400
132973069 _Sunrise C Oct. 25, 2021, 3 a.m. OK GNU C++14 TESTS 31 15 1126400
132971630 _jhq C Oct. 25, 2021, 2:22 a.m. OK GNU C++14 TESTS 31 15 1126400
132976544 zzzgw C Oct. 25, 2021, 4:19 a.m. OK GNU C++14 TESTS 31 15 1126400
132975919 rld C Oct. 25, 2021, 4:06 a.m. OK GNU C++14 TESTS 31 15 1126400
132975792 Geeklog C Oct. 25, 2021, 4:03 a.m. OK GNU C++14 TESTS 31 15 1126400
132972177 KrySt4l C Oct. 25, 2021, 2:38 a.m. OK GNU C++17 TESTS 31 15 1126400
132971879 Xiaozhu C Oct. 25, 2021, 2:29 a.m. OK GNU C++17 TESTS 31 15 1126400
132970816 zero4338 C Oct. 25, 2021, 1:56 a.m. OK GNU C++17 TESTS 31 15 1126400
132969590 TangDong C Oct. 25, 2021, 1:11 a.m. OK GNU C++17 TESTS 31 15 1126400
132954886 rakshitkumarsharma C Oct. 24, 2021, 6:25 p.m. OK GNU C++17 TESTS 31 15 1126400
132947339 ErCierony C Oct. 24, 2021, 4:33 p.m. OK GNU C++17 TESTS 31 15 1126400
132977091 wulisha C Oct. 25, 2021, 4:30 a.m. OK GNU C++17 TESTS 31 15 1126400
132974850 Hinder_01 C Oct. 25, 2021, 3:42 a.m. OK GNU C++17 TESTS 31 15 1126400
132974450 Llf0703 C Oct. 25, 2021, 3:32 a.m. OK GNU C++17 TESTS 31 15 1126400
132974333 feveTernAl C Oct. 25, 2021, 3:29 a.m. OK GNU C++17 TESTS 31 15 1126400
132945836 JPLovever C Oct. 24, 2021, 4:13 p.m. OK GNU C++17 (64) TESTS 31 15 1331200
132968998 froggyzhang C Oct. 25, 2021, 12:48 a.m. OK GNU C++17 (64) TESTS 31 15 1433600
132968996 dblark C Oct. 25, 2021, 12:48 a.m. OK GNU C++17 (64) TESTS 31 15 1433600
132935127 TomiokapEace C Oct. 24, 2021, 2:12 p.m. OK GNU C++17 (64) TESTS 31 15 1433600
132936028 devinqu C Oct. 24, 2021, 2:21 p.m. OK GNU C++17 (64) TESTS 31 15 1536000
132976688 Bit_Master_2205 C Oct. 25, 2021, 4:22 a.m. OK GNU C++17 (64) TESTS 31 15 1536000
132975196 sidaaaaa C Oct. 25, 2021, 3:50 a.m. OK GNU C++17 (64) TESTS 31 15 1536000
132944159 _DaNeK_ C Oct. 24, 2021, 3:51 p.m. OK GNU C++17 (64) TESTS 31 15 1536000
132981010 Abhi23.08 C Oct. 25, 2021, 5:41 a.m. OK GNU C++17 (64) TESTS 31 15 1638400
132981027 neo_37 C Oct. 25, 2021, 5:41 a.m. OK GNU C++17 (64) TESTS 31 15 1638400
132976826 lolias C Oct. 25, 2021, 4:25 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132976019 Kharanshu31 C Oct. 25, 2021, 4:08 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132970186 zemin-jiang C Oct. 25, 2021, 1:32 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132967933 BugLeave C Oct. 24, 2021, 11:51 p.m. OK GNU C++20 (64) TESTS 31 15 1536000
132966737 Arkady_E C Oct. 24, 2021, 10:49 p.m. OK GNU C++20 (64) TESTS 31 15 1536000
132966330 cyrux21 C Oct. 24, 2021, 10:31 p.m. OK GNU C++20 (64) TESTS 31 15 1536000
132978438 leonkacowicz C Oct. 25, 2021, 4:56 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132979159 Manish_jha C Oct. 25, 2021, 5:09 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132978351 ashutosh.2805 C Oct. 25, 2021, 4:55 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132977995 Amanshah123 C Oct. 25, 2021, 4:48 a.m. OK GNU C++20 (64) TESTS 31 15 1536000
132945043 D05T0N C Oct. 24, 2021, 4:02 p.m. OK Go TESTS 31 31 61440000
132980774 iamsoumik C Oct. 25, 2021, 5:37 a.m. OK Java 11 TESTS 31 171 24576000
132954432 aayushdhakad C Oct. 24, 2021, 6:18 p.m. OK Java 11 TESTS 31 171 24576000
132946496 SaberXpro C Oct. 24, 2021, 4:22 p.m. OK Java 11 TESTS 31 171 24576000
132957209 KarMa_ C Oct. 24, 2021, 7 p.m. OK Java 11 TESTS 31 171 24678400
132974947 RegalBeast C Oct. 25, 2021, 3:44 a.m. OK Java 11 TESTS 31 171 24780800
132964077 goyalronak3 C Oct. 24, 2021, 9:17 p.m. OK Java 11 TESTS 31 186 24678400
132936416 Moazahmed C Oct. 24, 2021, 2:25 p.m. OK Java 11 TESTS 31 186 24678400
132942630 kartheek542 C Oct. 24, 2021, 3:33 p.m. OK Java 11 TESTS 31 187 24473600
132929608 I-am-Batman C Oct. 24, 2021, 1:27 p.m. OK Java 11 TESTS 31 187 24473600
132928145 Tourist_ka_baap777 C Oct. 24, 2021, 1:15 p.m. OK Java 11 TESTS 31 202 24473600
132949515 NighTurs C Oct. 24, 2021, 5:04 p.m. OK Java 8 TESTS 31 93 18944000
132938712 Depool C Oct. 24, 2021, 2:49 p.m. OK Java 8 TESTS 31 108 18739200
132981238 AnshX C Oct. 25, 2021, 5:45 a.m. OK Java 8 TESTS 31 108 18841600
132976123 RISHI_RAJ_SINGH C Oct. 25, 2021, 4:11 a.m. OK Java 8 TESTS 31 108 18841600
132951511 smahajan54842 C Oct. 24, 2021, 5:36 p.m. OK Java 8 TESTS 31 108 18841600
132931503 bugbuster81 C Oct. 24, 2021, 1:40 p.m. OK Java 8 TESTS 31 108 18841600
132937358 Srikanth1777 C Oct. 24, 2021, 2:35 p.m. OK Java 8 TESTS 31 108 18944000
132976476 arpit31 C Oct. 25, 2021, 4:18 a.m. OK Java 8 TESTS 31 124 18841600
132971895 shaurya024 C Oct. 25, 2021, 2:30 a.m. OK Java 8 TESTS 31 124 19558400
132949712 athu18 C Oct. 24, 2021, 5:07 p.m. OK Java 8 TESTS 31 140 19046400
132956452 huy.caohuyhuy123 C Oct. 24, 2021, 6:48 p.m. OK Kotlin 1.5 TESTS 31 202 24678400
132927994 BruteForcee C Oct. 24, 2021, 1:14 p.m. OK Kotlin 1.5 TESTS 31 218 24678400
132946789 ERIWUG C Oct. 24, 2021, 4:26 p.m. OK Kotlin 1.5 TESTS 31 233 25497600
132930649 _Astron C Oct. 24, 2021, 1:34 p.m. OK Kotlin 1.5 TESTS 31 373 25190400
132944543 _lcj C Oct. 24, 2021, 3:56 p.m. OK MS C++ 2017 TESTS 31 15 1228800
132979585 swz C Oct. 25, 2021, 5:16 a.m. OK MS C++ 2017 TESTS 31 15 1433600
132942659 tjdvyzl12345 C Oct. 24, 2021, 3:33 p.m. OK MS C++ 2017 TESTS 31 15 1433600
132971319 Agumon C Oct. 25, 2021, 2:12 a.m. OK MS C++ 2017 TESTS 31 15 2150400
132973934 vjudge4 C Oct. 25, 2021, 3:20 a.m. OK MS C++ 2017 TESTS 31 30 2150400
132972384 sgly33 C Oct. 25, 2021, 2:43 a.m. OK MS C++ 2017 TESTS 31 31 1228800
132928419 Tangerine C Oct. 24, 2021, 1:16 p.m. OK MS C++ 2017 TESTS 31 31 1740800
132946460 plevande C Oct. 24, 2021, 4:21 p.m. OK PyPy 3 TESTS 31 92 20275200
132978923 saurabhbisht C Oct. 25, 2021, 5:05 a.m. OK PyPy 3 TESTS 31 108 20172800
132957876 paulmorenkov C Oct. 24, 2021, 7:11 p.m. OK PyPy 3 TESTS 31 108 20377600
132982206 coolstreaming C Oct. 25, 2021, 6:01 a.m. OK PyPy 3 TESTS 31 108 20582400
132980976 bsheep014 C Oct. 25, 2021, 5:40 a.m. OK PyPy 3 TESTS 31 108 20889600
132949692 Greyhound C Oct. 24, 2021, 5:07 p.m. OK PyPy 3 TESTS 31 109 21094400
132933940 hardikj C Oct. 24, 2021, 2:01 p.m. OK PyPy 3 TESTS 31 109 24268800
132930154 3juhwan C Oct. 24, 2021, 1:31 p.m. OK PyPy 3 TESTS 31 109 26419200
132938632 mnkp C Oct. 24, 2021, 2:48 p.m. OK PyPy 3 TESTS 31 124 25600000
132928861 nsp3333 C Oct. 24, 2021, 1:19 p.m. OK PyPy 3 TESTS 31 124 27340800
132938993 inksamurai C Oct. 24, 2021, 2:52 p.m. OK PyPy 3-64 TESTS 31 78 32358400
132938583 inksamurai C Oct. 24, 2021, 2:48 p.m. OK PyPy 3-64 TESTS 31 92 32358400
132938948 makly C Oct. 24, 2021, 2:51 p.m. OK PyPy 3-64 TESTS 31 93 32358400
132959601 HETRAKESHFADIA C Oct. 24, 2021, 7:42 p.m. OK PyPy 3-64 TESTS 31 93 33075200
132959542 swagsy C Oct. 24, 2021, 7:41 p.m. OK PyPy 3-64 TESTS 31 93 34713600
132951549 mayank35 C Oct. 24, 2021, 5:36 p.m. OK PyPy 3-64 TESTS 31 93 40960000
132938442 Beamstripe C Oct. 24, 2021, 2:46 p.m. OK PyPy 3-64 TESTS 31 93 40960000
132945978 pam4ek C Oct. 24, 2021, 4:15 p.m. OK PyPy 3-64 TESTS 31 93 41062400
132975573 pedastrian57 C Oct. 25, 2021, 3:58 a.m. OK PyPy 3-64 TESTS 31 93 163430400
132931664 Poojan919 C Oct. 24, 2021, 1:42 p.m. OK PyPy 3-64 TESTS 31 108 33996800
132957067 .Machine C Oct. 24, 2021, 6:58 p.m. OK Python 3 TESTS 31 124 5222400
132932605 armsusman C Oct. 24, 2021, 1:49 p.m. OK Python 3 TESTS 31 124 5836800
132945801 Haradama C Oct. 24, 2021, 4:12 p.m. OK Python 3 TESTS 31 139 5222400
132937312 amanpro_grammer C Oct. 24, 2021, 2:34 p.m. OK Python 3 TESTS 31 139 5222400
132976450 arine C Oct. 25, 2021, 4:18 a.m. OK Python 3 TESTS 31 155 5222400
132930324 jogepari C Oct. 24, 2021, 1:32 p.m. OK Python 3 TESTS 31 155 5222400
132931170 hwei002 C Oct. 24, 2021, 1:38 p.m. OK Python 3 TESTS 31 186 5222400
132944985 gokufan1769 C Oct. 24, 2021, 4:02 p.m. OK Python 3 TESTS 31 312 5222400
132929231 kaustavshouvik C Oct. 24, 2021, 1:24 p.m. OK Python 3 TESTS 31 327 5017600
132927997 SeriousProgrammer C Oct. 24, 2021, 1:14 p.m. OK Python 3 TESTS 31 373 6656000
132967714 SorKierkegaard C Oct. 24, 2021, 11:40 p.m. OK Rust TESTS 31 31 2867200
132967743 Eulim C Oct. 24, 2021, 11:41 p.m. OK Rust TESTS 31 46 2969600
132964312 IvanDyachenko C Oct. 24, 2021, 9:23 p.m. OK Scala TESTS 31 514 38297600

remove filters

Back to search problems