Codeforces Round 1059 (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
2162 Codeforces Round 1059 (Div. 3) FINISHED False 8100 15693923 Oct. 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 27714 ) B Beautiful String PROGRAMMING constructive algorithms

You are given a binary(^{\text{∗}}) string (s) of length (n). Your task is to find any subsequence(^{\text{†}}) (p) of (s) such that: The subsequence (p) is non-decreasing . That is, each character in (p) is not greater than the next one. Let (x) denote the string obtained by removing all characters of (p) from (s) , while preserving the order of the remaining characters. Then (x) must be a palindrome (^{\text{‡}}). You only need to output any valid subsequence (p) that satisfies both conditions. If no such subsequence exists, output (-1). Note that an empty string is both non-decreasing and a palindrome. (^{\text{∗}})A binary string is a string consisting of characters ' 0 ' and ' 1 '. (^{\text{†}})A subsequence of a string (s = s_1s_2\ldots s_n) is a sequence (p = s_{i_1}s_{i_2}\ldots s_{i_k}) such that (1 \leq i_1 < i_2 < \ldots < i_k \leq n). The characters are selected in order, but not necessarily contiguously. Note that an empty string is a subsequence of any string. (^{\text{‡}})A string (t = t_1t_2\ldots t_m) is a palindrome if (t_i = t_{m - i + 1}) for all (1 \leq i \leq m). In other words, the string reads the same forward and backward. The first line contains a single integer (t) ((1 \le t \le 3000)) — the number of test cases. The first line of each test case contains a single integer (n) ((1 \le n \le 10)) — the length of the string. The second line contains a binary string (s) of length (n). If a solution exists: On the first line, print a single integer (k) ((0 \le k \le n)) — the length of the subsequence (p). On the second line, print (k) distinct integers (i_1, i_2, \dots, i_k) ((1 \le i_1 < i_2 < \dots < i_k \le n)) — the indices of the characters in (s) that form (p) (in order as they appear in (s)). Otherwise, print a single line containing (-1). In the first test case, we remo

Tutorials

Codeforces Round 1059 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
344588843 Aditya_gudadhe B Oct. 19, 2025, 5:42 a.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344586301 B1ACK5_CYAN B Oct. 19, 2025, 5:13 a.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344584212 ArcXt B Oct. 19, 2025, 4:41 a.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344573363 orccyberpunk B Oct. 19, 2025, 12:41 a.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344571488 Mo7amedAbady B Oct. 18, 2025, 11:22 p.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344541703 isa-Cpp B Oct. 18, 2025, 5:16 p.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344517663 Mauiza B Oct. 18, 2025, 2:44 p.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344507515 __JT__ B Oct. 18, 2025, 1:49 p.m. OK C++17 (GCC 7-32) TESTS 34 46 0
344589445 adityashukla.sun B Oct. 19, 2025, 5:48 a.m. OK C++17 (GCC 7-32) TESTS 34 61 0
344585626 yang00 B Oct. 19, 2025, 5:04 a.m. OK C++17 (GCC 7-32) TESTS 34 61 0
344572211 nilesh_27 B Oct. 18, 2025, 11:50 p.m. OK C++20 (GCC 13-64) TESTS 34 46 0
344540935 __Archit B Oct. 18, 2025, 5:11 p.m. OK C++20 (GCC 13-64) TESTS 34 46 0
344528744 miracat B Oct. 18, 2025, 3:52 p.m. OK C++20 (GCC 13-64) TESTS 34 46 0
344509366 golden_dragonking B Oct. 18, 2025, 1:58 p.m. OK C++20 (GCC 13-64) TESTS 34 46 0
344505596 miyan1221 B Oct. 18, 2025, 1:38 p.m. OK C++20 (GCC 13-64) TESTS 34 46 0
344426077 exhasan B Oct. 18, 2025, 3:49 a.m. OK C++20 (GCC 13-64) TESTS 34 46 0
344578134 yzzlqyxc B Oct. 19, 2025, 2:51 a.m. OK C++20 (GCC 13-64) TESTS 34 46 102400
344574847 no_name_man B Oct. 19, 2025, 1:32 a.m. OK C++20 (GCC 13-64) TESTS 34 46 102400
344493835 mathworker21 B Oct. 18, 2025, 12:29 p.m. OK C++20 (GCC 13-64) TESTS 34 46 102400
344575096 060524 B Oct. 19, 2025, 1:40 a.m. OK C++20 (GCC 13-64) TESTS 34 46 8089600
344588637 grind_on B Oct. 19, 2025, 5:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344584772 AlexQA B Oct. 19, 2025, 4:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344583261 decoder_45 B Oct. 19, 2025, 4:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344581328 sarayu_g B Oct. 19, 2025, 3:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344578900 AdnanZaman B Oct. 19, 2025, 3:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344575331 dogfootone B Oct. 19, 2025, 1:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344573443 exccc B Oct. 19, 2025, 12:45 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344559961 dofore B Oct. 18, 2025, 7:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344545713 Basmala B Oct. 18, 2025, 5:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344537135 VEER_DODIYA B Oct. 18, 2025, 4:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 46 0
344502969 AlexandruAchilleF B Oct. 18, 2025, 1:23 p.m. OK GNU C11 TESTS 34 171 102400
344421211 jaishreeram123 B Oct. 18, 2025, 2:38 a.m. OK GNU C11 TESTS 34 171 1126400
344437699 SHAHRIAR_MAHI B Oct. 18, 2025, 5:50 a.m. OK GNU C11 TESTS 34 186 102400
344495416 imranbinhafiz B Oct. 18, 2025, 12:38 p.m. OK GNU C11 TESTS 34 187 102400
344420730 shivam_9939 B Oct. 18, 2025, 2:29 a.m. OK GNU C11 TESTS 34 202 102400
344428431 jai314 B Oct. 18, 2025, 4:18 a.m. OK GNU C11 TESTS 34 202 204800
344499512 shivam_9939 B Oct. 18, 2025, 1:02 p.m. OK GNU C11 TESTS 34 217 102400
344420816 shivam_9939 B Oct. 18, 2025, 2:30 a.m. OK GNU C11 TESTS 34 218 102400
344420784 shivam_9939 B Oct. 18, 2025, 2:30 a.m. OK GNU C11 TESTS 34 234 102400
344583050 roisRADIATA B Oct. 19, 2025, 4:22 a.m. OK GNU C11 TESTS 34 265 102400
344506035 owi8270 B Oct. 18, 2025, 1:41 p.m. OK Go TESTS 34 61 921600
344536997 harsha187 B Oct. 18, 2025, 4:45 p.m. OK Go TESTS 34 77 819200
344425440 hana_yuki B Oct. 18, 2025, 3:40 a.m. OK Go TESTS 34 531 4710400
344530917 GODAJM B Oct. 18, 2025, 4:06 p.m. OK Java 21 TESTS 34 264 1331200
344512866 Satyam_Arg B Oct. 18, 2025, 2:17 p.m. OK Java 21 TESTS 34 280 1024000
344425657 bomakhamchha B Oct. 18, 2025, 3:43 a.m. OK Java 21 TESTS 34 280 1024000
344547357 loganwick.jr B Oct. 18, 2025, 5:55 p.m. OK Java 21 TESTS 34 296 819200
344563660 kartik__sethi B Oct. 18, 2025, 8:35 p.m. OK Java 21 TESTS 34 296 1024000
344524497 akshatjai258 B Oct. 18, 2025, 3:25 p.m. OK Java 21 TESTS 34 296 1126400
344514668 Ani17et B Oct. 18, 2025, 2:27 p.m. OK Java 21 TESTS 34 296 1433600
344585878 santhoshdande1009 B Oct. 19, 2025, 5:08 a.m. OK Java 21 TESTS 34 296 1536000
344576009 Bhuvi_will B Oct. 19, 2025, 2:06 a.m. OK Java 21 TESTS 34 296 1638400
344493290 Ayush_Raj_2027 B Oct. 18, 2025, 12:26 p.m. OK Java 21 TESTS 34 296 2150400
344563020 dimple_girl B Oct. 18, 2025, 8:28 p.m. OK Java 8 TESTS 34 155 0
344584036 KaranKamath B Oct. 19, 2025, 4:39 a.m. OK Java 8 TESTS 34 156 0
344563583 dimple_girl B Oct. 18, 2025, 8:34 p.m. OK Java 8 TESTS 34 156 0
344541383 yashvardhan3 B Oct. 18, 2025, 5:14 p.m. OK Java 8 TESTS 34 156 0
344433964 NonlinearFish B Oct. 18, 2025, 5:16 a.m. OK Java 8 TESTS 34 186 0
344574212 DevDiva B Oct. 19, 2025, 1:12 a.m. OK Java 8 TESTS 34 202 0
344497140 Pranav_45 B Oct. 18, 2025, 12:48 p.m. OK Java 8 TESTS 34 202 39014400
344423815 venarys B Oct. 18, 2025, 3:17 a.m. OK Java 8 TESTS 34 233 0
344541930 hellomy_321 B Oct. 18, 2025, 5:17 p.m. OK Java 8 TESTS 34 234 0
344554910 NavneetKumar123 B Oct. 18, 2025, 6:58 p.m. OK Java 8 TESTS 34 249 0
344525472 alibichgaleleyev B Oct. 18, 2025, 3:31 p.m. OK Kotlin 2.2 TESTS 34 217 0
344546997 arif318khan B Oct. 18, 2025, 5:52 p.m. OK Kotlin 2.2 TESTS 34 280 0
344540616 chrisc B Oct. 18, 2025, 5:08 p.m. OK Node.js TESTS 34 187 10240000
344508172 Biggaypig B Oct. 18, 2025, 1:52 p.m. OK PyPy 3 TESTS 34 218 7168000
344420193 Boxwastaken_ B Oct. 18, 2025, 2:20 a.m. OK PyPy 3 TESTS 34 249 7577600
344510478 adityakudale2712 B Oct. 18, 2025, 2:04 p.m. OK PyPy 3 TESTS 34 264 9830400
344417340 Pingo_does_coding B Oct. 18, 2025, 1:30 a.m. OK PyPy 3 TESTS 34 265 7987200
344591006 Uday_Aditya7 B Oct. 19, 2025, 6:02 a.m. OK PyPy 3 TESTS 34 281 8396800
344536844 MdNazmulHossain B Oct. 18, 2025, 4:44 p.m. OK PyPy 3 TESTS 34 296 9420800
344430572 amn9130 B Oct. 18, 2025, 4:42 a.m. OK PyPy 3 TESTS 34 421 8806400
344587322 tooth_pick B Oct. 19, 2025, 5:26 a.m. OK PyPy 3-64 TESTS 34 109 4915200
344426383 BakhtiyarZBJ B Oct. 18, 2025, 3:53 a.m. OK PyPy 3-64 TESTS 34 124 3276800
344553072 concavity19 B Oct. 18, 2025, 6:40 p.m. OK PyPy 3-64 TESTS 34 125 6041600
344560931 Olesya.raz B Oct. 18, 2025, 8:03 p.m. OK PyPy 3-64 TESTS 34 140 3481600
344568047 nappenheimer B Oct. 18, 2025, 9:51 p.m. OK PyPy 3-64 TESTS 34 140 4198400
344568096 Amogh_Gajera B Oct. 18, 2025, 9:52 p.m. OK PyPy 3-64 TESTS 34 140 5939200
344569653 NotWacky77 B Oct. 18, 2025, 10:29 p.m. OK PyPy 3-64 TESTS 34 155 5017600
344529866 evaumou B Oct. 18, 2025, 3:59 p.m. OK PyPy 3-64 TESTS 34 155 5017600
344564313 mxdycn B Oct. 18, 2025, 8:44 p.m. OK PyPy 3-64 TESTS 34 155 6348800
344530143 _NATHAN B Oct. 18, 2025, 4:01 p.m. OK PyPy 3-64 TESTS 34 155 6860800
344509307 shadow990 B Oct. 18, 2025, 1:58 p.m. OK Python 3 TESTS 34 77 1433600
344582635 saihrushita2508 B Oct. 19, 2025, 4:15 a.m. OK Python 3 TESTS 34 77 1536000
344587515 brijmohan_17 B Oct. 19, 2025, 5:28 a.m. OK Python 3 TESTS 34 93 0
344573673 LogiAce B Oct. 19, 2025, 12:54 a.m. OK Python 3 TESTS 34 93 0
344573400 densefeature B Oct. 19, 2025, 12:42 a.m. OK Python 3 TESTS 34 93 0
344435546 kaluginpeter B Oct. 18, 2025, 5:29 a.m. OK Python 3 TESTS 34 93 0
344556279 felipeft B Oct. 18, 2025, 7:11 p.m. OK Python 3 TESTS 34 93 102400
344554198 pranshu11 B Oct. 18, 2025, 6:51 p.m. OK Python 3 TESTS 34 93 102400
344427287 SushiTrash B Oct. 18, 2025, 4:04 a.m. OK Python 3 TESTS 34 93 102400
344533670 haochenglin454 B Oct. 18, 2025, 4:23 p.m. OK Python 3 TESTS 34 93 1433600
344425567 MoSooN B Oct. 18, 2025, 3:42 a.m. OK Rust 2021 TESTS 34 92 102400
344586680 TheLunaticDev B Oct. 19, 2025, 5:18 a.m. OK Rust 2021 TESTS 34 124 102400
344426669 hana_yuki B Oct. 18, 2025, 3:57 a.m. OK Rust 2024 TESTS 34 624 102400

remove filters

Back to search problems