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
( 14261 ) B Flipping Binary String PROGRAMMING constructive algorithms strings

You are given a binary string (s) of length (n). You can perform the following operation on the string: Choose an index (i), and flip the bit present at all other indices except for the index (i). In other words, choose an integer (i) ((1 \le i \le n)), and for all (j) such that (1 \le j \le n) and (j \ne i), if (s_j = 0), then set (s_j:=1), otherwise set (s_j:=0). You can perform the operation any number of times, but each index can be chosen by at most one operation. Your task is to make all bits present in the string (s) equal (0), or report that it is impossible to do so. You don't have to minimize the number of operations. 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 2 \cdot 10^5)). The second line of each test case contains the binary string (s) of length (n). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output (-1) if it is impossible to transform all bits to (0). Otherwise, output two lines in the following format: In the first line, print the number of operations (x) ((0 \leq x \leq n)). In the second line of each test case, print (x) numbers – the indices you select in each operation in order. You should guarantee that each index is chosen at most once. If there are multiple possible solutions, you may output any. In the first test case, performing the operation on index (2) means flipping bits present at index (1) and (3). So the new string formed will be (000). In the second test case, it can be shown that we cannot make string (a) equal to (000) using the described operations.

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
363893452 nksammirPL B Feb. 21, 2026, 4:09 p.m. OK C# 13 TESTS 10 93 17408000
363927388 vinod_09 B Feb. 21, 2026, 8:16 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363913527 lastlife B Feb. 21, 2026, 6:08 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363907869 bloody_lord B Feb. 21, 2026, 5:27 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363902400 Viajero_anstick B Feb. 21, 2026, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363902175 chidrup_18 B Feb. 21, 2026, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363899815 Last_Bencher0_0 B Feb. 21, 2026, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363899071 nhatganarcho B Feb. 21, 2026, 4:23 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363896868 KsCipher B Feb. 21, 2026, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363896554 dhananjit B Feb. 21, 2026, 4:17 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363893657 BeSerious B Feb. 21, 2026, 4:10 p.m. OK C++17 (GCC 7-32) TESTS 10 31 0
363949502 MegaZid B Feb. 22, 2026, 3:56 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363946964 anya_Cf B Feb. 22, 2026, 3 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363945200 porzlck B Feb. 22, 2026, 2:12 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363940007 alaa-_- B Feb. 21, 2026, 11:56 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363939984 Abdo_Gaber.3 B Feb. 21, 2026, 11:55 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363932610 Georggg999 B Feb. 21, 2026, 9:23 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363928114 lbm47 B Feb. 21, 2026, 8:24 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363925390 adityajoshi0016 B Feb. 21, 2026, 7:56 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363922341 Chinmaya_R_Nayaka B Feb. 21, 2026, 7:26 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363910847 Honululu_RR B Feb. 21, 2026, 5:48 p.m. OK C++20 (GCC 13-64) TESTS 10 31 0
363956934 khushicodes03 B Feb. 22, 2026, 5:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363954865 012345 B Feb. 22, 2026, 5:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363950759 Abdelhamid_ B Feb. 22, 2026, 4:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363942863 ljy_qwq B Feb. 22, 2026, 1:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363941465 sharp_mindedxx B Feb. 22, 2026, 12:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363938770 SuperMighty B Feb. 21, 2026, 11:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363938704 GOJO_GOKU_KURAMA B Feb. 21, 2026, 11:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363938574 Yuanzhe_zyz B Feb. 21, 2026, 11:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363938470 LazyMind B Feb. 21, 2026, 11:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363936867 kirtinasha999 B Feb. 21, 2026, 10:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
363895177 1435730 B Feb. 21, 2026, 4:14 p.m. OK GNU C11 TESTS 10 46 102400
363955693 ajgar_badmash7 B Feb. 22, 2026, 5:43 a.m. OK GNU C11 TESTS 10 781 1024000
363900440 Sayantan_Hazra B Feb. 21, 2026, 4:27 p.m. OK GNU C11 TESTS 10 796 204800
363897156 Akshat_Khurdia B Feb. 21, 2026, 4:19 p.m. OK GNU C11 TESTS 10 796 307200
363900203 Flames_36 B Feb. 21, 2026, 4:26 p.m. OK GNU C11 TESTS 10 812 204800
363895534 rand0math B Feb. 21, 2026, 4:15 p.m. OK GNU C11 TESTS 10 812 204800
363896549 ano_rohit B Feb. 21, 2026, 4:17 p.m. OK GNU C11 TESTS 10 843 102400
363919341 Atromitos B Feb. 21, 2026, 6:58 p.m. OK GNU C11 TESTS 10 843 204800
363900902 praneeth_r B Feb. 21, 2026, 4:28 p.m. OK GNU C11 TESTS 10 843 1843200
363901359 COMPETITIVE_KRISH B Feb. 21, 2026, 4:29 p.m. OK GNU C11 TESTS 10 859 102400
363949871 LittleGopher B Feb. 22, 2026, 4:04 a.m. OK Go TESTS 10 46 2969600
363949702 LittleGopher B Feb. 22, 2026, 4:01 a.m. OK Go TESTS 10 62 6860800
363897390 va.pogoreloff B Feb. 21, 2026, 4:19 p.m. OK Go TESTS 10 62 6963200
363895193 Divya04P B Feb. 21, 2026, 4:14 p.m. OK Java 21 TESTS 10 203 3686400
363899135 vrajrajput2005 B Feb. 21, 2026, 4:24 p.m. OK Java 21 TESTS 10 218 204800
363900311 jr6778541 B Feb. 21, 2026, 4:27 p.m. OK Java 21 TESTS 10 218 716800
363902621 smrt_nerd B Feb. 21, 2026, 4:32 p.m. OK Java 21 TESTS 10 234 102400
363902484 panzer_pj B Feb. 21, 2026, 4:31 p.m. OK Java 21 TESTS 10 234 307200
363947435 harshalwaghmare89 B Feb. 22, 2026, 3:12 a.m. OK Java 21 TESTS 10 234 1740800
363895963 AnakinThe2nd B Feb. 21, 2026, 4:16 p.m. OK Java 21 TESTS 10 234 3276800
363901915 Shailu_03 B Feb. 21, 2026, 4:30 p.m. OK Java 21 TESTS 10 250 409600
363945818 Ningzhuo B Feb. 22, 2026, 2:28 a.m. OK Java 21 TESTS 10 250 512000
363906950 Azad_Singh B Feb. 21, 2026, 5:20 p.m. OK Java 21 TESTS 10 250 614400
363897039 Saniya_A B Feb. 21, 2026, 4:18 p.m. OK Java 8 TESTS 10 109 4403200
363947055 Vishalll_ B Feb. 22, 2026, 3:03 a.m. OK Java 8 TESTS 10 109 5529600
363898929 yashu_rai B Feb. 21, 2026, 4:23 p.m. OK Java 8 TESTS 10 125 5324800
363900984 Sritej_96 B Feb. 21, 2026, 4:28 p.m. OK Java 8 TESTS 10 140 3788800
363894081 Anjali_ie B Feb. 21, 2026, 4:11 p.m. OK Java 8 TESTS 10 140 4300800
363903401 sammedsh07 B Feb. 21, 2026, 4:33 p.m. OK Java 8 TESTS 10 140 4608000
363899279 hk3382 B Feb. 21, 2026, 4:24 p.m. OK Java 8 TESTS 10 140 4608000
363908605 kirenvision28 B Feb. 21, 2026, 5:32 p.m. OK Java 8 TESTS 10 156 4403200
363908781 abhayrajnegi0416 B Feb. 21, 2026, 5:33 p.m. OK Java 8 TESTS 10 171 0
363896900 sahastra_g_cf B Feb. 21, 2026, 4:18 p.m. OK Java 8 TESTS 10 187 6144000
363897533 aiyucodes B Feb. 21, 2026, 4:20 p.m. OK Kotlin 2.2 TESTS 10 171 24371200
363895589 prvshkmrin B Feb. 21, 2026, 4:15 p.m. OK Kotlin 2.2 TESTS 10 203 25190400
363921259 Alyona_M B Feb. 21, 2026, 7:16 p.m. OK PyPy 3 TESTS 10 515 19865600
363898992 harrowfung B Feb. 21, 2026, 4:23 p.m. OK PyPy 3-64 TESTS 10 93 20480000
363895176 Cxainnz B Feb. 21, 2026, 4:14 p.m. OK PyPy 3-64 TESTS 10 109 9728000
363901927 Seniorious1 B Feb. 21, 2026, 4:30 p.m. OK PyPy 3-64 TESTS 10 125 8499200
363912151 cheesesh B Feb. 21, 2026, 5:57 p.m. OK PyPy 3-64 TESTS 10 125 16179200
363901564 tar324123 B Feb. 21, 2026, 4:29 p.m. OK PyPy 3-64 TESTS 10 125 17817600
363894986 shrinil B Feb. 21, 2026, 4:13 p.m. OK PyPy 3-64 TESTS 10 125 25088000
363924252 jengnun B Feb. 21, 2026, 7:47 p.m. OK PyPy 3-64 TESTS 10 125 27955200
363943070 Little_Sheep_Yawn B Feb. 22, 2026, 1:21 a.m. OK PyPy 3-64 TESTS 10 140 12595200
363915489 Yared_Alemayehu B Feb. 21, 2026, 6:23 p.m. OK PyPy 3-64 TESTS 10 140 13721600
363895454 Bulo4kaa B Feb. 21, 2026, 4:14 p.m. OK PyPy 3-64 TESTS 10 156 6758400
363902705 vmdharshini B Feb. 21, 2026, 4:32 p.m. OK Python 2 TESTS 10 140 8396800
363900840 JashCodes B Feb. 21, 2026, 4:28 p.m. OK Python 3 TESTS 10 78 16896000
363897283 someone_isme B Feb. 21, 2026, 4:19 p.m. OK Python 3 TESTS 10 93 16896000
363911663 Alyona_M B Feb. 21, 2026, 5:54 p.m. OK Python 3 TESTS 10 93 20684800
363921865 Alyona_M B Feb. 21, 2026, 7:22 p.m. OK Python 3 TESTS 10 93 24678400
363956871 wrkdivan B Feb. 22, 2026, 5:59 a.m. OK Python 3 TESTS 10 109 14438400
363901404 divy_py B Feb. 21, 2026, 4:29 p.m. OK Python 3 TESTS 10 109 16384000
363926606 arindam027g B Feb. 21, 2026, 8:08 p.m. OK Python 3 TESTS 10 109 20787200
363895322 doghmen.melekd7 B Feb. 21, 2026, 4:14 p.m. OK Python 3 TESTS 10 109 21094400
363895862 QuantIM B Feb. 21, 2026, 4:15 p.m. OK Python 3 TESTS 10 109 21811200
363902275 Lalatendu_Biswal B Feb. 21, 2026, 4:31 p.m. OK Python 3 TESTS 10 109 22835200
363936034 _JG_ B Feb. 21, 2026, 10:21 p.m. OK Rust 2024 TESTS 10 46 2252800

remove filters

Back to search problems