Codeforces Round 1082 (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
2202 Codeforces Round 1082 (Div. 2) FINISHED False 9000 4548323 Feb. 23, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 10817 ) B ABAB Construction PROGRAMMING greedy implementation

There is a string (T) of length (n), such that (T_i=) ' a ' for all odd (i) and (T_i=) ' b ' for all even (i). One day, Bob generated a string (S) with the following algorithm. Initialize (S) to the empty string. Remove either the first letter or the last letter from (T), and append it to (S). If (T) is empty, terminate and return the string (S). Otherwise, go back to the second step. Then, Bob wrote down the generated string (S) on a note and forgot about it for a few years. The note was worn out when Bob found it, and someone might have secretly changed some letters. Of course, Bob wants to know if someone did alter the string! You are given a string (X) of length (n), which consists of ' a ', ' b ', and ' ? '. Please determine if there exists a string (A) which satisfies the following conditions: (|A|=n); (A_i) is either ' a ' or ' b ' for all (1 \le i \le n); (A_i=X_i) for all (1 \le i \le n) such that (X_i) is not ' ? '; The string (A) can be generated from the algorithm described above. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 200\,000)). The second line of each test case contains a string (X) of length (n), consisting of ' a ', ' b ', and ' ? '. It is guaranteed that the sum of (n) over all test cases does not exceed (200\,000). If there is a string (A) that satisfies all conditions, output " YES " on a separate line. If there is no string (A) that satisfies all conditions, output " NO " on a separate line. You can output the answer in any case. For example, the strings " yEs ", " yes ", " Yes " will also be recognized as positive responses. For the second test case, the string " baaba " cannot be generated by the algorithm descr

Tutorials

Codeforces Round 1082 (Div. 1, Div. 2) Complete Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
364143114 Tuguldur1024 B Feb. 24, 2026, 2:36 a.m. OK C++17 (GCC 7-32) TESTS 10 15 0
364155365 mayankhere567 B Feb. 24, 2026, 6:06 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364150591 Antu_2203012 B Feb. 24, 2026, 4:54 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364148229 mqh415 B Feb. 24, 2026, 4:12 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364147497 Sireesh18 B Feb. 24, 2026, 3:59 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364146572 ANUJ_0007 B Feb. 24, 2026, 3:43 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364146417 amankrdk4 B Feb. 24, 2026, 3:40 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364145087 suhaifa B Feb. 24, 2026, 3:15 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364143864 liyuff B Feb. 24, 2026, 2:52 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364142814 agarwal_shaleen B Feb. 24, 2026, 2:30 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
364099886 Rohit_28 B Feb. 23, 2026, 4:53 p.m. OK C++20 (GCC 13-64) TESTS 10 15 102400
364145751 ASKuntal B Feb. 24, 2026, 3:28 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364154243 Balaji_B B Feb. 24, 2026, 5:51 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364152819 Abdullah21 B Feb. 24, 2026, 5:32 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364150268 Radient_Bit B Feb. 24, 2026, 4:49 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364149812 santujahangira B Feb. 24, 2026, 4:41 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364149238 sumitg2004 B Feb. 24, 2026, 4:31 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364149115 jocularferret B Feb. 24, 2026, 4:29 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364145885 tongdst B Feb. 24, 2026, 3:30 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364143147 WHITEINK B Feb. 24, 2026, 2:37 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
364142067 Raymoo_ B Feb. 24, 2026, 2:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 15 102400
364087770 Ayon B Feb. 23, 2026, 4:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 15 102400
364151034 G_Cell B Feb. 24, 2026, 5:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364155160 S_Nagar B Feb. 24, 2026, 6:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364154165 sssatty B Feb. 24, 2026, 5:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364153250 hetpethani17 B Feb. 24, 2026, 5:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364151807 pranay128_ B Feb. 24, 2026, 5:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364151505 SpeedWasp B Feb. 24, 2026, 5:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364150983 NidHESh27 B Feb. 24, 2026, 5:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364150396 Tanzim411 B Feb. 24, 2026, 4:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
364111118 ruban B Feb. 23, 2026, 6:20 p.m. OK FPC TESTS 10 125 45056000
364115967 hash123 B Feb. 23, 2026, 7:08 p.m. OK GNU C11 TESTS 10 46 102400
364099693 EshuuRam B Feb. 23, 2026, 4:52 p.m. OK GNU C11 TESTS 10 46 102400
364098468 praneeth_r B Feb. 23, 2026, 4:48 p.m. OK GNU C11 TESTS 10 46 204800
364119122 ajgar_badmash7 B Feb. 23, 2026, 7:40 p.m. OK GNU C11 TESTS 10 62 204800
364099543 frag_ B Feb. 23, 2026, 4:52 p.m. OK GNU C11 TESTS 10 62 614400
364090562 suhak235711 B Feb. 23, 2026, 4:23 p.m. OK GNU C11 TESTS 10 62 1126400
364093435 SaraZeynalzada B Feb. 23, 2026, 4:32 p.m. OK GNU C11 TESTS 10 78 204800
364143758 LittleGopher B Feb. 24, 2026, 2:49 a.m. OK Go TESTS 10 31 1433600
364108379 chethan_coding B Feb. 23, 2026, 5:57 p.m. OK Go TESTS 10 31 1433600
364087607 timode-6 B Feb. 23, 2026, 4:14 p.m. OK Go TESTS 10 109 68915200
364089113 __0xCk__ B Feb. 23, 2026, 4:19 p.m. OK Java 21 TESTS 10 171 512000
364130669 Ishan.Boral.1810 B Feb. 23, 2026, 9:56 p.m. OK Java 21 TESTS 10 187 409600
364089971 aayushdtotiwari B Feb. 23, 2026, 4:21 p.m. OK Java 21 TESTS 10 187 409600
364154097 Devstudent01 B Feb. 24, 2026, 5:49 a.m. OK Java 21 TESTS 10 187 614400
364102211 BiggestFish06 B Feb. 23, 2026, 5 p.m. OK Java 21 TESTS 10 203 614400
364146826 sathwikhbhat B Feb. 24, 2026, 3:47 a.m. OK Java 21 TESTS 10 203 716800
364087163 VKS0104 B Feb. 23, 2026, 4:13 p.m. OK Java 21 TESTS 10 218 102400
364089592 BitHunter_65_ B Feb. 23, 2026, 4:20 p.m. OK Java 21 TESTS 10 218 307200
364118808 justsaurab B Feb. 23, 2026, 7:37 p.m. OK Java 21 TESTS 10 218 512000
364153988 sakshams7778 B Feb. 24, 2026, 5:48 a.m. OK Java 21 TESTS 10 218 614400
364126098 from_zero_cp B Feb. 23, 2026, 9:01 p.m. OK Java 8 TESTS 10 109 0
364124850 abhayrajnegi0416 B Feb. 23, 2026, 8:47 p.m. OK Java 8 TESTS 10 125 0
364088856 raghunandandev B Feb. 23, 2026, 4:18 p.m. OK Java 8 TESTS 10 140 0
364097530 AchalVishnoi B Feb. 23, 2026, 4:45 p.m. OK Java 8 TESTS 10 140 14438400
364098037 VikrantYadav2005 B Feb. 23, 2026, 4:47 p.m. OK Java 8 TESTS 10 156 0
364092261 Litish B Feb. 23, 2026, 4:28 p.m. OK Java 8 TESTS 10 156 0
364086996 giri777 B Feb. 23, 2026, 4:13 p.m. OK Java 8 TESTS 10 156 0
364153813 rushi1105 B Feb. 24, 2026, 5:45 a.m. OK Java 8 TESTS 10 187 0
364111892 manhbnvn3102 B Feb. 23, 2026, 6:27 p.m. OK Java 8 TESTS 10 203 0
364093234 pullagurlavaishnavi B Feb. 23, 2026, 4:31 p.m. OK Java 8 TESTS 10 218 0
364127471 konni35 B Feb. 23, 2026, 9:17 p.m. OK Kotlin 2.2 TESTS 10 140 24473600
364116177 xxxtentaclez B Feb. 23, 2026, 7:10 p.m. OK Kotlin 2.2 TESTS 10 156 102400
364113829 xxxtentaclez B Feb. 23, 2026, 6:46 p.m. OK Kotlin 2.2 TESTS 10 156 25088000
364095215 mehalpandkar B Feb. 23, 2026, 4:38 p.m. OK PyPy 3 TESTS 10 203 6246400
364152037 WaffleMan B Feb. 24, 2026, 5:19 a.m. OK PyPy 3 TESTS 10 265 9113600
364116303 gardengnome B Feb. 23, 2026, 7:11 p.m. OK PyPy 3-64 TESTS 10 62 4198400
364087908 scholarritvik B Feb. 23, 2026, 4:15 p.m. OK PyPy 3-64 TESTS 10 78 3891200
364096845 realclueless B Feb. 23, 2026, 4:43 p.m. OK PyPy 3-64 TESTS 10 78 3993600
364094598 prarthnaa24427 B Feb. 23, 2026, 4:36 p.m. OK PyPy 3-64 TESTS 10 78 4403200
364100535 ashashank3672 B Feb. 23, 2026, 4:55 p.m. OK PyPy 3-64 TESTS 10 93 3686400
364097940 Adnene_ben_khemis B Feb. 23, 2026, 4:47 p.m. OK PyPy 3-64 TESTS 10 93 5324800
364087133 gouthamlingoju B Feb. 23, 2026, 4:13 p.m. OK PyPy 3-64 TESTS 10 93 6758400
364131269 DVP01 B Feb. 23, 2026, 10:03 p.m. OK PyPy 3-64 TESTS 10 93 16281600
364095306 GRIF B Feb. 23, 2026, 4:38 p.m. OK PyPy 3-64 TESTS 10 109 3993600
364093315 prakhya15 B Feb. 23, 2026, 4:32 p.m. OK PyPy 3-64 TESTS 10 109 4608000
364093438 satkurikailash B Feb. 23, 2026, 4:32 p.m. OK Python 2 TESTS 10 968 2457600
364096405 nileshtiwari5625 B Feb. 23, 2026, 4:42 p.m. OK Python 3 TESTS 10 78 716800
364108527 Arantx1 B Feb. 23, 2026, 5:58 p.m. OK Python 3 TESTS 10 78 819200
364087636 BruhBoii B Feb. 23, 2026, 4:15 p.m. OK Python 3 TESTS 10 78 819200
364102813 deb22 B Feb. 23, 2026, 5:02 p.m. OK Python 3 TESTS 10 93 716800
364092119 VSS402002_Muhammad_Adil B Feb. 23, 2026, 4:28 p.m. OK Python 3 TESTS 10 93 716800
364088626 vishalakshi175 B Feb. 23, 2026, 4:17 p.m. OK Python 3 TESTS 10 93 716800
364087100 MythiCODE B Feb. 23, 2026, 4:13 p.m. OK Python 3 TESTS 10 93 716800
364092232 Rule01 B Feb. 23, 2026, 4:28 p.m. OK Python 3 TESTS 10 109 716800
364099735 DrgnTyrnt B Feb. 23, 2026, 4:53 p.m. OK Python 3 TESTS 10 109 819200
364107456 marthapavan2002 B Feb. 23, 2026, 5:50 p.m. OK Python 3 TESTS 10 125 819200
364114181 macaroni5708 B Feb. 23, 2026, 6:49 p.m. OK Rust 2021 TESTS 10 46 102400
364142808 Tantellam B Feb. 24, 2026, 2:30 a.m. OK Rust 2024 TESTS 10 31 0
364137368 silicalet B Feb. 24, 2026, 12:13 a.m. OK Rust 2024 TESTS 10 46 11776000
364122513 DanielAnker B Feb. 23, 2026, 8:22 p.m. OK Rust 2024 TESTS 10 46 11776000
364106618 sandcrawler B Feb. 23, 2026, 5:45 p.m. OK Rust 2024 TESTS 10 734 21606400

remove filters

Back to search problems