Codeforces Round 867 (Div. 3)

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
1822 Codeforces Round 867 (Div. 3) FINISHED False 8100 49476299 April 24, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10591 ) E Making Anti-Palindromes PROGRAMMING greedy math strings

B'You are given a string s , consisting of lowercase English letters. In one operation, you are allowed to swap any two characters of the string s . A string s of length n is called an anti-palindrome, if s[i] ne s[n - i + 1] for every i ( 1 <= i <= n ). For example, the strings "codeforces", "string" are anti-palindromes, but the strings "abacaba", "abc", "test" are not. Determine the minimum number of operations required to make the string s an anti-palindrome, or output -1 , if this is not possible. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. Each test case consists of two lines. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of the string s . The second line contains the string s , consisting of n lowercase English letters. The sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the minimum number of operations required to make the string s an anti-palindrome, or -1 if this is not possible. In the first test case, the string "codeforces" is already an anti-palindrome, so the answer is 0 . In the second test case, it can be shown that the string "abc" cannot be transformed into an anti-palindrome by performing the allowed operations, so the answer is -1 . In the third test case, it is enough to swap the second and the fifth characters of the string "taarrrataa", and the new string "trararataa" will be an anti-palindrome, so the answer is 1 . '...

Tutorials

Codeforces Round #867 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
203357146 Anastasiya_Andreevna E April 24, 2023, 6:14 p.m. OK C# 8 TESTS 12 233 3891200
203358785 Anastasiya_Andreevna E April 24, 2023, 6:30 p.m. OK C# 8 TESTS 12 264 3891200
203345303 Mishra_09 E April 24, 2023, 4:53 p.m. OK Clang++17 Diagnostics TESTS 12 452 13004800
203358920 ruban E April 24, 2023, 6:32 p.m. OK FPC TESTS 12 46 40038400
203388205 cryingrain E April 25, 2023, 2:59 a.m. OK GNU C++14 TESTS 26 15 204800
203351787 xgyxgy E April 24, 2023, 5:29 p.m. OK GNU C++14 TESTS 12 15 204800
203397254 devansh789 E April 25, 2023, 5:17 a.m. OK GNU C++14 TESTS 26 15 512000
203391150 gabrudj E April 25, 2023, 3:43 a.m. OK GNU C++14 TESTS 26 15 512000
203390243 Homura_jar E April 25, 2023, 3:31 a.m. OK GNU C++14 TESTS 26 15 512000
203388071 sauravbhartibgs37 E April 25, 2023, 2:57 a.m. OK GNU C++14 TESTS 26 15 512000
203387003 IskhakKutBilim E April 25, 2023, 2:39 a.m. OK GNU C++14 TESTS 26 15 512000
203386122 Radiaa E April 25, 2023, 2:22 a.m. OK GNU C++14 TESTS 26 15 512000
203380755 WATL E April 25, 2023, 12:28 a.m. OK GNU C++14 TESTS 26 15 512000
203379363 alkaid2003 E April 24, 2023, 11:56 p.m. OK GNU C++14 TESTS 26 15 512000
203392188 WonderRide E April 25, 2023, 3:59 a.m. OK GNU C++17 TESTS 26 15 204800
203386221 wDwDwDw E April 25, 2023, 2:24 a.m. OK GNU C++17 TESTS 26 15 204800
203383535 NanYangNanChui E April 25, 2023, 1:29 a.m. OK GNU C++17 TESTS 26 15 204800
203361034 AINgray E April 24, 2023, 6:52 p.m. OK GNU C++17 TESTS 12 15 204800
203352979 SajibKC_19 E April 24, 2023, 5:38 p.m. OK GNU C++17 TESTS 12 15 204800
203400108 lindi530 E April 25, 2023, 5:56 a.m. OK GNU C++17 TESTS 26 15 307200
203380085 Gevin E April 25, 2023, 12:13 a.m. OK GNU C++17 TESTS 26 15 307200
203349791 wdgkd E April 24, 2023, 5:16 p.m. OK GNU C++17 TESTS 12 15 307200
203400474 Hex-willappear E April 25, 2023, 6:01 a.m. OK GNU C++17 TESTS 26 15 512000
203399436 AIshuo E April 25, 2023, 5:47 a.m. OK GNU C++17 TESTS 26 15 512000
203386377 Colblue E April 25, 2023, 2:27 a.m. OK GNU C++17 (64) TESTS 26 15 204800
203400247 inzamam_inz E April 25, 2023, 5:58 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203397625 mobbb E April 25, 2023, 5:22 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203393043 drizzle_codes E April 25, 2023, 4:12 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203392397 AlfaGenus E April 25, 2023, 4:02 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203389422 DengJ E April 25, 2023, 3:18 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203383795 touxinzei E April 25, 2023, 1:34 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203383354 Xylenox E April 25, 2023, 1:25 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203382034 Newbie_QQH E April 25, 2023, 12:57 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203381103 hhux E April 25, 2023, 12:36 a.m. OK GNU C++17 (64) TESTS 26 15 512000
203396798 Yhlas_Y E April 25, 2023, 5:10 a.m. OK GNU C++20 (64) TESTS 26 0 512000
203378726 thisislike E April 24, 2023, 11:40 p.m. OK GNU C++20 (64) TESTS 26 0 512000
203362911 Aboelhamd.X_x E April 24, 2023, 7:11 p.m. OK GNU C++20 (64) TESTS 12 0 512000
203359486 sersawy E April 24, 2023, 6:37 p.m. OK GNU C++20 (64) TESTS 12 0 512000
203352818 iliya7 E April 24, 2023, 5:36 p.m. OK GNU C++20 (64) TESTS 12 0 512000
203349146 electrojay27 E April 24, 2023, 5:11 p.m. OK GNU C++20 (64) TESTS 12 0 512000
203345929 alishejhf E April 24, 2023, 4:56 p.m. OK GNU C++20 (64) TESTS 12 0 819200
203392027 ace-in-the-hole E April 25, 2023, 3:57 a.m. OK GNU C++20 (64) TESTS 26 0 8499200
203346219 Gzi0604 E April 24, 2023, 4:57 p.m. OK GNU C++20 (64) TESTS 12 0 16588800
203395141 lococ E April 25, 2023, 4:46 a.m. OK GNU C++20 (64) TESTS 26 15 204800
203355199 princeayush04 E April 24, 2023, 5:56 p.m. OK Java 11 TESTS 12 202 0
203390906 the_unseen E April 25, 2023, 3:40 a.m. OK Java 11 TESTS 26 233 0
203370259 Yousef_Badr E April 24, 2023, 8:47 p.m. OK Java 11 TESTS 12 233 0
203348424 XIN E April 24, 2023, 5:08 p.m. OK Java 11 TESTS 12 249 0
203355059 Abusseiit E April 24, 2023, 5:55 p.m. OK Java 11 TESTS 12 264 0
203360662 ch2001 E April 24, 2023, 6:49 p.m. OK Java 11 TESTS 12 265 0
203354997 Kenzhezhan E April 24, 2023, 5:54 p.m. OK Java 17 TESTS 12 171 204800
203353947 coder0687 E April 24, 2023, 5:46 p.m. OK Java 17 TESTS 12 187 409600
203384101 Eslam_Ahmed E April 25, 2023, 1:41 a.m. OK Java 17 TESTS 26 202 819200
203347869 puriabhijit000 E April 24, 2023, 5:05 p.m. OK Java 17 TESTS 12 217 102400
203347600 m0rka1 E April 24, 2023, 5:03 p.m. OK Java 17 TESTS 12 218 102400
203365989 pt_dtu E April 24, 2023, 7:47 p.m. OK Java 17 TESTS 12 233 102400
203356581 this.is.shivamsingh E April 24, 2023, 6:09 p.m. OK Java 17 TESTS 12 233 307200
203346687 leoxiao2015 E April 24, 2023, 4:59 p.m. OK Java 17 TESTS 12 233 409600
203364807 American_Eagle E April 24, 2023, 7:32 p.m. OK Java 17 TESTS 12 280 204800
203365128 American_Eagle E April 24, 2023, 7:36 p.m. OK Java 17 TESTS 12 295 921600
203358734 invincible777 E April 24, 2023, 6:30 p.m. OK Java 8 TESTS 12 124 0
203392360 yvbf E April 25, 2023, 4:01 a.m. OK Java 8 TESTS 26 155 0
203391225 toufique_husein E April 25, 2023, 3:44 a.m. OK Java 8 TESTS 26 155 0
203361810 UniversalAdmin E April 24, 2023, 7 p.m. OK Java 8 TESTS 12 155 0
203395951 Camellia- E April 25, 2023, 4:58 a.m. OK Java 8 TESTS 26 171 0
203365913 depurador_ik E April 24, 2023, 7:46 p.m. OK Java 8 TESTS 12 217 38297600
203392076 wdjuruo E April 25, 2023, 3:57 a.m. OK Java 8 TESTS 26 218 0
203375614 lpychemistry E April 24, 2023, 10:28 p.m. OK Java 8 TESTS 26 280 0
203352894 tatianyi E April 24, 2023, 5:37 p.m. OK MS C++ 2017 TESTS 12 31 614400
203368638 incuiio E April 24, 2023, 8:23 p.m. OK MS C++ 2017 TESTS 12 46 614400
203396154 huminclu E April 25, 2023, 5:01 a.m. OK MS C++ 2017 TESTS 26 61 614400
203361251 valavshonok E April 24, 2023, 6:54 p.m. OK MS C++ 2017 TESTS 12 77 614400
203352692 ahtoh_ E April 24, 2023, 5:35 p.m. OK Node.js TESTS 12 140 5632000
203352429 Alex239 E April 24, 2023, 5:33 p.m. OK PyPy 3 TESTS 12 389 9011200
203345882 Imeon E April 24, 2023, 4:55 p.m. OK PyPy 3 TESTS 12 405 7987200
203398390 atLeastBlue E April 25, 2023, 5:32 a.m. OK PyPy 3 TESTS 26 530 8704000
203373112 hxu10 E April 24, 2023, 9:34 p.m. OK PyPy 3 TESTS 26 670 9318400
203362364 hash1025 E April 24, 2023, 7:06 p.m. OK PyPy 3 TESTS 12 794 12390400
203346608 SoleProprietor E April 24, 2023, 4:58 p.m. OK PyPy 3-64 TESTS 12 93 4710400
203349755 OmarMoBadr E April 24, 2023, 5:15 p.m. OK PyPy 3-64 TESTS 12 109 13824000
203382164 just-a-byte E April 25, 2023, 1 a.m. OK PyPy 3-64 TESTS 26 124 13824000
203395952 bandiaoz E April 25, 2023, 4:58 a.m. OK PyPy 3-64 TESTS 26 155 13516800
203359246 oneku16 E April 24, 2023, 6:35 p.m. OK PyPy 3-64 TESTS 12 170 5017600
203359370 oneku16 E April 24, 2023, 6:36 p.m. OK PyPy 3-64 TESTS 12 171 4505600
203346968 yingkui E April 24, 2023, 5 p.m. OK PyPy 3-64 TESTS 12 171 9830400
203359458 oneku16 E April 24, 2023, 6:37 p.m. OK PyPy 3-64 TESTS 12 186 4505600
203367509 gardengnome E April 24, 2023, 8:07 p.m. OK PyPy 3-64 TESTS 12 202 9011200
203347335 gesuta E April 24, 2023, 5:02 p.m. OK PyPy 3-64 TESTS 12 202 9932800
203384555 xin2002 E April 25, 2023, 1:50 a.m. OK Python 3 TESTS 26 171 1536000
203399462 RahulSinghIITD E April 25, 2023, 5:48 a.m. OK Python 3 TESTS 26 186 1638400
203346689 Susshanth E April 24, 2023, 4:59 p.m. OK Python 3 TESTS 12 202 409600
203396092 cpchenpi E April 25, 2023, 5 a.m. OK Rust 2021 TESTS 26 15 512000

remove filters

Back to search problems