Codeforces Round 1073 (Div. 1)

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
2190 Codeforces Round 1073 (Div. 1) FINISHED False 10800 7745123 Jan. 17, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 16899 ) A Sorting Game PROGRAMMING games greedy

Alice and Bob play a game on a binary string (s) of length (n) (a string consisting only of characters (\mathtt{0}) and (\mathtt{1})). Alice moves first, and the players take alternate turns. In one turn, a player chooses a sequence of indices (i_1, i_2, \ldots, i_m) ((1 \le i_1 < i_2 < \ldots < i_m \le n)) such that the characters at these positions form a non-increasing sequence (that is, (s_{i_1} \ge s_{i_2} \ge \ldots \ge s_{i_m})). The player then rearranges the characters at these positions to be sorted in non-decreasing order. Formally, let the chosen characters consist of (z) zeros and (o) ones (where (z + o = m)). The move replaces the characters at positions (i_1, i_2, \ldots, i_m) with a sequence of (z) zeros followed by (o) ones. A move is valid if and only if it strictly modifies the string (s) (which implies (z \ge 1) and (o \ge 1)). The player who cannot make a valid move loses. Assuming both players play optimally, determine the winner. If Alice wins, output a valid first move that is part of a winning strategy. 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 consists of a single integer (n) ((1 \le n \le 2 \cdot 10^5)) — the length of the string (s). The second line of each test case contains a binary string (s) of length (n) consisting of only characters (\mathtt{0}) and (\mathtt{1}). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output one or three lines: If Bob wins with optimal play, print a single line containing " Bob ". Otherwise, print three lines. On the first line print " Alice ". On the second line print an integer (m) ((2 \le m \le n)), and on the third line print (m) distinct integers $$$i_1, i_2, \ldots, i

Tutorials

Codeforces Round 1073 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
358270855 Luvidi A Jan. 17, 2026, 2:44 p.m. OK C++17 (GCC 7-32) TESTS 13 31 0
358408358 lucky_888 A Jan. 18, 2026, 5:20 a.m. OK C++17 (GCC 7-32) TESTS 13 31 102400
358276751 firewater A Jan. 17, 2026, 2:49 p.m. OK C++17 (GCC 7-32) TESTS 13 31 102400
358269832 _stdout_ A Jan. 17, 2026, 2:43 p.m. OK C++17 (GCC 7-32) TESTS 13 31 102400
358273953 jli505 A Jan. 17, 2026, 2:46 p.m. OK C++17 (GCC 7-32) TESTS 13 31 819200
358296774 Zemu_Zzz A Jan. 17, 2026, 3:09 p.m. OK C++17 (GCC 7-32) TESTS 13 46 0
358279317 Nickir A Jan. 17, 2026, 2:51 p.m. OK C++17 (GCC 7-32) TESTS 13 46 0
358279180 alex-yandex A Jan. 17, 2026, 2:51 p.m. OK C++17 (GCC 7-32) TESTS 13 46 0
358272120 RDFZchenyy A Jan. 17, 2026, 2:45 p.m. OK C++17 (GCC 7-32) TESTS 13 46 0
358263617 FinrodF A Jan. 17, 2026, 2:38 p.m. OK C++17 (GCC 7-32) TESTS 13 46 0
358269919 cyx A Jan. 17, 2026, 2:43 p.m. OK C++20 (GCC 13-64) TESTS 13 15 102400
358405733 Aerysaint A Jan. 18, 2026, 4:43 a.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358387680 gvihvo A Jan. 17, 2026, 8:48 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358379997 mita A Jan. 17, 2026, 7:18 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358290746 SmuggingSpon A Jan. 17, 2026, 3:02 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358287884 mjtai A Jan. 17, 2026, 2:59 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358286299 Shifted A Jan. 17, 2026, 2:58 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358278364 Guanexxx A Jan. 17, 2026, 2:50 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358276102 wksp A Jan. 17, 2026, 2:48 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358275710 Sachchit A Jan. 17, 2026, 2:48 p.m. OK C++20 (GCC 13-64) TESTS 13 31 0
358403223 Fackthisshit A Jan. 18, 2026, 3:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358397926 _XVIIVX A Jan. 18, 2026, 1:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358387584 mukit235 A Jan. 17, 2026, 8:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358293532 junliang123 A Jan. 17, 2026, 3:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358282375 WA_ON_TEST_2 A Jan. 17, 2026, 2:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358279840 BlackAnt A Jan. 17, 2026, 2:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358279031 Aldk A Jan. 17, 2026, 2:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358276917 Kindinred A Jan. 17, 2026, 2:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358276630 danx A Jan. 17, 2026, 2:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358276355 Lifeste4l A Jan. 17, 2026, 2:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 31 0
358318549 hos.lyric A Jan. 17, 2026, 3:38 p.m. OK D TESTS 13 171 2355200
358268616 pengin_2000 A Jan. 17, 2026, 2:42 p.m. OK GNU C11 TESTS 13 31 921600
358268010 Ritwin A Jan. 17, 2026, 2:41 p.m. OK GNU C11 TESTS 13 421 921600
358265401 showtime A Jan. 17, 2026, 2:40 p.m. OK Go TESTS 13 46 4505600
358263730 scau_accepted A Jan. 17, 2026, 2:38 p.m. OK Go TESTS 13 62 4198400
358292721 lybord A Jan. 17, 2026, 3:04 p.m. OK Java 21 TESTS 13 234 716800
358296902 MBBN A Jan. 17, 2026, 3:09 p.m. OK Java 21 TESTS 13 265 819200
358394083 aha A Jan. 17, 2026, 11:30 p.m. OK Java 21 TESTS 13 312 1331200
358375906 MXZV A Jan. 17, 2026, 6:44 p.m. OK Java 21 TESTS 13 390 2048000
358271982 malachi_toney_goat A Jan. 17, 2026, 2:45 p.m. OK Java 8 TESTS 13 171 0
358267611 LeoPro A Jan. 17, 2026, 2:41 p.m. OK Kotlin 1.7 TESTS 13 500 50073600
358385697 MdKhanBahadurSadi A Jan. 17, 2026, 8:19 p.m. OK Kotlin 2.2 TESTS 13 140 0
358349891 Tlatoani A Jan. 17, 2026, 4:38 p.m. OK Kotlin 2.2 TESTS 13 234 25292800
358403446 Itachi42O A Jan. 18, 2026, 4:01 a.m. OK PyPy 3 TESTS 13 375 9523200
358268205 imaiwluv A Jan. 17, 2026, 2:42 p.m. OK PyPy 3-64 TESTS 13 78 11571200
358266635 _______________________ A Jan. 17, 2026, 2:40 p.m. OK PyPy 3-64 TESTS 13 93 9728000
358278663 bcollet A Jan. 17, 2026, 2:50 p.m. OK PyPy 3-64 TESTS 13 109 9830400
358282806 Emikooh A Jan. 17, 2026, 2:54 p.m. OK PyPy 3-64 TESTS 13 125 9318400
358268112 hitman_py A Jan. 17, 2026, 2:42 p.m. OK PyPy 3-64 TESTS 13 140 8499200
358265096 conqueror_of_tourist A Jan. 17, 2026, 2:39 p.m. OK PyPy 3-64 TESTS 13 140 9830400
358268052 McPqndq A Jan. 17, 2026, 2:41 p.m. OK PyPy 3-64 TESTS 13 140 13721600
358273486 yupooh A Jan. 17, 2026, 2:46 p.m. OK PyPy 3-64 TESTS 13 140 14028800
358270481 flakepym A Jan. 17, 2026, 2:43 p.m. OK PyPy 3-64 TESTS 13 140 19353600
358264865 the_last_smilodon A Jan. 17, 2026, 2:39 p.m. OK PyPy 3-64 TESTS 13 156 7884800
358269980 Jimanbanashi A Jan. 17, 2026, 2:43 p.m. OK Python 2 TESTS 13 109 5734400
358384047 duckladydinh A Jan. 17, 2026, 7:59 p.m. OK Python 3 TESTS 13 187 7577600
358266607 MoSooN A Jan. 17, 2026, 2:40 p.m. OK Rust 2021 TESTS 13 46 2764800
358282273 rusters A Jan. 17, 2026, 2:54 p.m. OK Rust 2021 TESTS 13 62 0
358266712 sansen A Jan. 17, 2026, 2:40 p.m. OK Rust 2021 TESTS 13 62 0
358269877 Solalyth A Jan. 17, 2026, 2:43 p.m. OK Rust 2021 TESTS 13 78 16998400
358271036 Mon_ster A Jan. 17, 2026, 2:44 p.m. OK Rust 2024 TESTS 13 31 0
358275473 triple_affirmative A Jan. 17, 2026, 2:48 p.m. OK Rust 2024 TESTS 13 46 0
358399653 hirose2020 A Jan. 18, 2026, 2:41 a.m. OK Rust 2024 TESTS 13 46 11673600
358283703 Darknef A Jan. 17, 2026, 2:55 p.m. OK Rust 2024 TESTS 13 46 11673600
358264200 Sugar_fan A Jan. 17, 2026, 2:39 p.m. OK Rust 2024 TESTS 13 62 11776000

remove filters

Back to search problems