Codeforces Round 1081 (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
2192 Codeforces Round 1081 (Div. 2) FINISHED False 7200 4721123 Feb. 21, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 17673 ) A String Rotation Game PROGRAMMING brute force strings

Define a block in a string as a contiguous substring of characters of the same type that cannot be extended either to the left or the right. For example, in the string aabcccdaa , there are five blocks: aa ((1)-st to (2)-nd characters) b ((3)-rd character) ccc ((4)-th to (6)-th characters) d ((7)-th character) aa ((8)-th to (9)-th characters). You are playing a game where you are given a string (s) of length (n). You can cyclically rotate(^{\text{∗}}) the string however you want. Your score is then calculated as the number of blocks in the final string. Please find the maximum score possible. (^{\text{∗}})Formally, choose an index (1 \leq i \leq n), and replace the string (s_1s_2\ldots s_n) with the string (s_{i+1}s_{i+2}\ldots s_ns_1s_2\ldots s_{i}). For example, the string abcde can be rotated to string deabc by choosing (i=3). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 100)). The second line of each test case contains the string (s) of length (n). Strings (s) consist of lowercase Latin characters only. For each testcase, output a single integer denoting the maximum score you can achieve. In the first test case, score of the original string abcd is (4). It can be shown that a score greater than (4) cannot be achieved. In the second test case, cyclically rotating the string by (2) positions will give us string bcab . Score of this string is (4). It can be shown that a score greater than (4) cannot be achieved.

Tutorials

Codeforces Round 1081 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
363937519 khaledkhttab1 A Feb. 21, 2026, 10:54 p.m. OK C# 13 TESTS 4 78 12800000
363926878 soh.am A Feb. 21, 2026, 8:11 p.m. OK C++17 (GCC 7-32) TESTS 4 0 0
363957058 Peedobus01 A Feb. 22, 2026, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363957045 Hox_D_Aswin A Feb. 22, 2026, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363956747 Paul_Subh01 A Feb. 22, 2026, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363954328 aceclofenac A Feb. 22, 2026, 5:23 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363953103 CodeNerd_98 A Feb. 22, 2026, 5:02 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363952556 yogiraj151 A Feb. 22, 2026, 4:52 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363952298 Abdelaziz2004 A Feb. 22, 2026, 4:48 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363952199 DANTUI A Feb. 22, 2026, 4:46 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363951468 paashupatastra A Feb. 22, 2026, 4:32 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
363957310 expertaq A Feb. 22, 2026, 6:05 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363955499 amano_hina A Feb. 22, 2026, 5:40 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363955440 aviate A Feb. 22, 2026, 5:39 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363950937 rum3r A Feb. 22, 2026, 4:24 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363948685 amcphandle A Feb. 22, 2026, 3:36 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363947855 ankitlap6213 A Feb. 22, 2026, 3:21 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363941833 Oskr6128 A Feb. 22, 2026, 12:46 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363941597 2510876139 A Feb. 22, 2026, 12:40 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363941585 dssfsuper2 A Feb. 22, 2026, 12:40 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363941036 ChandanX A Feb. 22, 2026, 12:25 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
363955908 ch_aryan A Feb. 22, 2026, 5:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363955757 Pranav_19111 A Feb. 22, 2026, 5:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363955249 Kadyrzhan A Feb. 22, 2026, 5:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363955071 avin0v0 A Feb. 22, 2026, 5:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363953382 InfiniteWA A Feb. 22, 2026, 5:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363953165 Co_Well A Feb. 22, 2026, 5:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363953109 NotMe__ A Feb. 22, 2026, 5:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363952838 Code_keshri A Feb. 22, 2026, 4:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363951768 diguo A Feb. 22, 2026, 4:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363951061 anand_2703 A Feb. 22, 2026, 4:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
363917414 Sidharth007 A Feb. 21, 2026, 6:39 p.m. OK GNU C11 TESTS 4 0 0
363895124 suha_mila A Feb. 21, 2026, 4:14 p.m. OK GNU C11 TESTS 4 0 0
363926065 sj01_codeForces A Feb. 21, 2026, 8:03 p.m. OK GNU C11 TESTS 4 0 102400
363955779 Scoder028 A Feb. 22, 2026, 5:44 a.m. OK GNU C11 TESTS 4 15 0
363950884 asikM A Feb. 22, 2026, 4:22 a.m. OK GNU C11 TESTS 4 15 0
363947135 M-Ridea A Feb. 22, 2026, 3:05 a.m. OK GNU C11 TESTS 4 15 0
363943418 joakkinen A Feb. 22, 2026, 1:31 a.m. OK GNU C11 TESTS 4 15 0
363918973 Azaan_Syed A Feb. 21, 2026, 6:54 p.m. OK GNU C11 TESTS 4 15 0
363913981 amitgandhi336 A Feb. 21, 2026, 6:12 p.m. OK GNU C11 TESTS 4 15 0
363897473 yashvar.9680 A Feb. 21, 2026, 4:19 p.m. OK GNU C11 TESTS 4 15 0
363941735 uvwxz A Feb. 22, 2026, 12:44 a.m. OK Go TESTS 4 31 3276800
363949115 LittleGopher A Feb. 22, 2026, 3:48 a.m. OK Go TESTS 4 46 0
363916677 PegCarter01 A Feb. 21, 2026, 6:33 p.m. OK Go TESTS 4 46 3276800
363917678 glebio A Feb. 21, 2026, 6:42 p.m. OK Haskell TESTS 4 250 0
363923125 krishna_Singh25 A Feb. 21, 2026, 7:34 p.m. OK Java 21 TESTS 4 140 307200
363924656 vkisgoat A Feb. 21, 2026, 7:51 p.m. OK Java 21 TESTS 4 156 307200
363894474 IndomitableS A Feb. 21, 2026, 4:12 p.m. OK Java 21 TESTS 4 171 0
363918133 akasmik A Feb. 21, 2026, 6:46 p.m. OK Java 21 TESTS 4 171 307200
363926637 AviNlogN A Feb. 21, 2026, 8:09 p.m. OK Java 21 TESTS 4 171 512000
363911510 rengoku_07 A Feb. 21, 2026, 5:53 p.m. OK Java 21 TESTS 4 171 512000
363943566 Ningzhuo A Feb. 22, 2026, 1:35 a.m. OK Java 21 TESTS 4 171 716800
363918014 singularity_12 A Feb. 21, 2026, 6:45 p.m. OK Java 21 TESTS 4 171 716800
363922704 vineet28sept A Feb. 21, 2026, 7:30 p.m. OK Java 21 TESTS 4 187 307200
363922377 Ajaysawandkar05 A Feb. 21, 2026, 7:27 p.m. OK Java 21 TESTS 4 187 409600
363900410 Sritej_96 A Feb. 21, 2026, 4:27 p.m. OK Java 8 TESTS 4 109 0
363955914 adibhai0845R A Feb. 22, 2026, 5:46 a.m. OK Java 8 TESTS 4 125 0
363950149 kit28.24bcb051 A Feb. 22, 2026, 4:09 a.m. OK Java 8 TESTS 4 125 0
363946222 MACLOVER A Feb. 22, 2026, 2:39 a.m. OK Java 8 TESTS 4 125 0
363904125 charan_35 A Feb. 21, 2026, 4:34 p.m. OK Java 8 TESTS 4 125 0
363903162 Magicmega123 A Feb. 21, 2026, 4:33 p.m. OK Java 8 TESTS 4 125 0
363901364 yashu_rai A Feb. 21, 2026, 4:29 p.m. OK Java 8 TESTS 4 125 0
363897954 sharma__jii A Feb. 21, 2026, 4:21 p.m. OK Java 8 TESTS 4 125 0
363897738 Gopal-Gupta A Feb. 21, 2026, 4:20 p.m. OK Java 8 TESTS 4 125 0
363940947 22b01a05b9 A Feb. 22, 2026, 12:23 a.m. OK Java 8 TESTS 4 140 0
363896716 aiyucodes A Feb. 21, 2026, 4:18 p.m. OK Kotlin 2.2 TESTS 4 109 0
363943160 Struggle1259 A Feb. 22, 2026, 1:24 a.m. OK PyPy 3 TESTS 4 93 4300800
363911482 gagansingh3016 A Feb. 21, 2026, 5:52 p.m. OK PyPy 3 TESTS 4 140 4300800
363947803 Sruteesh A Feb. 22, 2026, 3:20 a.m. OK PyPy 3 TESTS 4 156 5120000
363924598 pulakbagaria A Feb. 21, 2026, 7:50 p.m. OK PyPy 3-64 TESTS 4 62 2048000
363923351 OAY71011 A Feb. 21, 2026, 7:37 p.m. OK PyPy 3-64 TESTS 4 62 2252800
363913029 reijnnn A Feb. 21, 2026, 6:04 p.m. OK PyPy 3-64 TESTS 4 62 2355200
363921960 Quadratic_Solver123 A Feb. 21, 2026, 7:23 p.m. OK PyPy 3-64 TESTS 4 62 2764800
363914698 fluffypacman A Feb. 21, 2026, 6:17 p.m. OK PyPy 3-64 TESTS 4 62 2764800
363912784 sashwathjs A Feb. 21, 2026, 6:02 p.m. OK PyPy 3-64 TESTS 4 62 2764800
363898005 Jaimin_Joshi A Feb. 21, 2026, 4:21 p.m. OK PyPy 3-64 TESTS 4 62 2764800
363934526 Tahir A Feb. 21, 2026, 9:52 p.m. OK PyPy 3-64 TESTS 4 62 2867200
363907322 omkaar A Feb. 21, 2026, 5:22 p.m. OK PyPy 3-64 TESTS 4 62 2867200
363937338 cp_hater A Feb. 21, 2026, 10:49 p.m. OK PyPy 3-64 TESTS 4 62 3379200
363951066 youngdp A Feb. 22, 2026, 4:26 a.m. OK Python 2 TESTS 4 46 0
363928084 harishkeerthimaans A Feb. 21, 2026, 8:23 p.m. OK Python 3 TESTS 4 31 0
363914596 muralivijay04 A Feb. 21, 2026, 6:16 p.m. OK Python 3 TESTS 4 31 0
363933546 womri1998 A Feb. 21, 2026, 9:36 p.m. OK Python 3 TESTS 4 46 0
363929381 MD.Zahin A Feb. 21, 2026, 8:38 p.m. OK Python 3 TESTS 4 46 0
363915047 eugalt A Feb. 21, 2026, 6:20 p.m. OK Python 3 TESTS 4 46 0
363909106 Alyona_M A Feb. 21, 2026, 5:36 p.m. OK Python 3 TESTS 4 46 0
363907653 sriharshini02 A Feb. 21, 2026, 5:25 p.m. OK Python 3 TESTS 4 46 0
363902245 abdulmusavir.juraev A Feb. 21, 2026, 4:31 p.m. OK Python 3 TESTS 4 46 0
363902053 zageh A Feb. 21, 2026, 4:30 p.m. OK Python 3 TESTS 4 46 0
363899590 doghmen.melekd7 A Feb. 21, 2026, 4:25 p.m. OK Python 3 TESTS 4 46 0
363934876 _JG_ A Feb. 21, 2026, 9:58 p.m. OK Rust 2024 TESTS 4 31 0
363895873 raghavverma6862 A Feb. 21, 2026, 4:15 p.m. OK Rust 2024 TESTS 4 31 0
363950786 TheRogueVigilante A Feb. 22, 2026, 4:21 a.m. OK Rust 2024 TESTS 4 31 11776000
363950237 TheRogueVigilante A Feb. 22, 2026, 4:11 a.m. OK Rust 2024 TESTS 4 31 11776000
363896784 CoHHa9_MyXa A Feb. 21, 2026, 4:18 p.m. OK Rust 2024 TESTS 4 62 11776000

remove filters

Back to search problems