Codeforces Round 1034 (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
2123 Codeforces Round 1034 (Div. 3) FINISHED False 8100 25025123 July 1, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 21739 ) D Binary String Battle PROGRAMMING constructive algorithms games greedy

Alice and Bob are given a binary string (s) of length (n), and an integer (k) ((1\leq k < n)). Alice wins if she is able to transform all characters of (s) into zeroes. If Alice is unable to win in a finite number of moves, then Bob wins. Alice and Bob take turns, with Alice going first. On Alice's turn, she may choose any subsequence (^{\text{∗}}) of length (k) in (s), then set all characters in that subsequence to zero. On Bob's turn, he may choose any substring (^{\text{†}}) of length (k) in (s), then set all characters in that substring to one. Note that Alice wins if the string consists of all zeros at any point during the game, including in between Alice's and Bob's turns. Determine who wins with optimal play. (^{\text{∗}})A subsequence of a string (s) is a set of characters in (s). Note that these characters do not have to be adjacent. (^{\text{†}})A substring of a string (s) is a contiguous group of characters in (s). Note that these characters must be adjacent. The first line contains an integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains two integers (n) and (k) ((2\leq n \leq 2\cdot 10^5), (1\leq k < n)). The second line of each test case contains a 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 on a single line " Alice " if Alice wins with optimal play, and " Bob " if Bob wins with optimal play. You can output the answer in any case (upper or lower). For example, the strings " aLiCe ", " alice ", " ALICE ", and " alICE " will be recognized as " Alice ". In the third sample, Alice can choose the subsequence consisting of (s_2), turning (s) into (000000). Then she wins immediately. In the fourth sample, it can be shown that there is no way for Alice to guarantee that she can tu

Tutorials

Codeforces Round 1034 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
327178647 og.kostya D July 3, 2025, 5:59 a.m. OK C# 13 TESTS 10 109 3174400
327178993 KYYYrie D July 3, 2025, 6:02 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327176087 Chemtioc D July 3, 2025, 5:34 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327174515 nathanutkarsh27 D July 3, 2025, 5:19 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327173089 Basar. D July 3, 2025, 5:06 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327169545 krishjustice D July 3, 2025, 4:27 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327169295 topcomder69 D July 3, 2025, 4:24 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327163299 E_Abishek D July 3, 2025, 3:10 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327162677 suzumeyosano D July 3, 2025, 3:03 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327162410 moonlitclandestine D July 3, 2025, 3 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327161361 practice-id D July 3, 2025, 2:46 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
327101966 usama12 D July 2, 2025, 2:26 p.m. OK C++20 (GCC 13-64) TESTS 10 31 102400
327178752 wrogn404 D July 3, 2025, 6 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327177034 anant.pandey D July 3, 2025, 5:45 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327173455 Sagordev117 D July 3, 2025, 5:09 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327162127 jxiaoming1 D July 3, 2025, 2:56 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327151830 jazaher7 D July 2, 2025, 11:31 p.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327149810 ByteVerse_ D July 2, 2025, 10:32 p.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327147633 Adel_Hefny D July 2, 2025, 9:42 p.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327145223 Coyote_Starrk D July 2, 2025, 8:57 p.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327142421 Salada D July 2, 2025, 8:15 p.m. OK C++20 (GCC 13-64) TESTS 10 46 0
327160118 jianjianj D July 3, 2025, 2:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
327178989 sun-goku D July 3, 2025, 6:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327178800 The_Last_Run D July 3, 2025, 6:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327176484 OTTFF D July 3, 2025, 5:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327175870 Lazarev_Nikolai D July 3, 2025, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327175461 Selvaragavan_C D July 3, 2025, 5:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327175221 MasteR_BaiteR D July 3, 2025, 5:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327171751 a_ho D July 3, 2025, 4:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327171653 its_naruto_uzumaki D July 3, 2025, 4:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327171503 farmpiggie D July 3, 2025, 4:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
327028295 ojas001 D July 2, 2025, 5:21 a.m. OK GNU C11 TESTS 10 62 307200
327178619 Andrew_is_alive D July 3, 2025, 5:59 a.m. OK GNU C11 TESTS 10 77 307200
327061086 Debojyoti_roy2005 D July 2, 2025, 9:48 a.m. OK GNU C11 TESTS 10 93 204800
327117019 owi8270 D July 2, 2025, 4:18 p.m. OK Go TESTS 10 61 1536000
327117276 owi8270 D July 2, 2025, 4:20 p.m. OK Go TESTS 10 77 1638400
327088323 viinayak20 D July 2, 2025, 12:51 p.m. OK Java 21 TESTS 10 218 1536000
327152235 cpp10 D July 2, 2025, 11:37 p.m. OK Java 21 TESTS 10 233 512000
327160971 MAFIA_GOD D July 3, 2025, 2:41 a.m. OK Java 21 TESTS 10 249 614400
327109685 winkhatri292004 D July 2, 2025, 3:24 p.m. OK Java 21 TESTS 10 249 614400
327129114 ravi_prakash29 D July 2, 2025, 5:57 p.m. OK Java 21 TESTS 10 249 819200
327152466 cpp10 D July 2, 2025, 11:44 p.m. OK Java 21 TESTS 10 249 1331200
327101679 KRRISH9977 D July 2, 2025, 2:25 p.m. OK Java 21 TESTS 10 250 1126400
327061430 de1usional D July 2, 2025, 9:50 a.m. OK Java 21 TESTS 10 264 512000
327177568 abhishekshivgan24 D July 3, 2025, 5:49 a.m. OK Java 21 TESTS 10 265 204800
327103371 Kshitiz_san D July 2, 2025, 2:37 p.m. OK Java 21 TESTS 10 265 614400
327073481 2767684782 D July 2, 2025, 11:14 a.m. OK Java 8 TESTS 10 140 0
327029385 2767684782 D July 2, 2025, 5:32 a.m. OK Java 8 TESTS 10 155 0
327099953 gaurimadan002 D July 2, 2025, 2:12 p.m. OK Java 8 TESTS 10 171 0
327085505 naveenchhipa2003 D July 2, 2025, 12:32 p.m. OK Java 8 TESTS 10 171 0
327099459 Sumitsingh7 D July 2, 2025, 2:09 p.m. OK Java 8 TESTS 10 171 6656000
327089158 satyams_9001 D July 2, 2025, 12:57 p.m. OK Java 8 TESTS 10 171 6656000
327102470 yanshisharma D July 2, 2025, 2:30 p.m. OK Java 8 TESTS 10 202 0
327026071 architasahoo02 D July 2, 2025, 5 a.m. OK Java 8 TESTS 10 202 0
327131977 Manojrout D July 2, 2025, 6:21 p.m. OK Java 8 TESTS 10 218 0
327117411 not_mohith D July 2, 2025, 4:21 p.m. OK Java 8 TESTS 10 218 0
327140041 jagbarrameda D July 2, 2025, 7:44 p.m. OK Kotlin 1.9 TESTS 10 186 307200
327119313 chinesedfan D July 2, 2025, 4:36 p.m. OK Node.js TESTS 10 124 6758400
327066174 YhuanDebeste D July 2, 2025, 10:22 a.m. OK Perl TESTS 10 62 0
327152300 ss6xybr8in D July 2, 2025, 11:39 p.m. OK PyPy 3 TESTS 10 156 6451200
327083100 naman.iitd28 D July 2, 2025, 12:16 p.m. OK PyPy 3 TESTS 10 249 6553600
327114970 Innnokent D July 2, 2025, 4:03 p.m. OK PyPy 3 TESTS 10 265 6553600
327106751 _Tremor_ D July 2, 2025, 3:02 p.m. OK PyPy 3 TESTS 10 281 9728000
327027938 dreamer_empty D July 2, 2025, 5:18 a.m. OK PyPy 3 TESTS 10 312 6758400
327134827 rabeysin D July 2, 2025, 6:46 p.m. OK PyPy 3 TESTS 10 312 7065600
327066100 l0stempl3 D July 2, 2025, 10:22 a.m. OK PyPy 3-64 TESTS 10 109 2150400
327176239 gardengnome D July 3, 2025, 5:36 a.m. OK PyPy 3-64 TESTS 10 109 3072000
327061780 kamio-misuzu D July 2, 2025, 9:53 a.m. OK PyPy 3-64 TESTS 10 109 4300800
327084743 ChuanSWT D July 2, 2025, 12:27 p.m. OK PyPy 3-64 TESTS 10 124 3993600
327024027 maharaja D July 2, 2025, 4:37 a.m. OK PyPy 3-64 TESTS 10 124 4505600
327125724 kibr D July 2, 2025, 5:29 p.m. OK PyPy 3-64 TESTS 10 124 4608000
327125881 IcyGirl D July 2, 2025, 5:30 p.m. OK PyPy 3-64 TESTS 10 124 5222400
327027583 pyorz D July 2, 2025, 5:15 a.m. OK PyPy 3-64 TESTS 10 139 3993600
327108973 b27energize D July 2, 2025, 3:19 p.m. OK PyPy 3-64 TESTS 10 139 7475200
327065023 Om_Singh_ D July 2, 2025, 10:14 a.m. OK PyPy 3-64 TESTS 10 140 4096000
327059193 preetamlodhi D July 2, 2025, 9:35 a.m. OK Python 3 TESTS 10 77 921600
327083596 lameee D July 2, 2025, 12:20 p.m. OK Python 3 TESTS 10 78 921600
327072058 BhaveshGandham D July 2, 2025, 11:04 a.m. OK Python 3 TESTS 10 93 819200
327057902 nirupamatiitd D July 2, 2025, 9:28 a.m. OK Python 3 TESTS 10 93 819200
327105331 u22cs081 D July 2, 2025, 2:51 p.m. OK Python 3 TESTS 10 93 921600
327064572 chatterjee_sid D July 2, 2025, 10:11 a.m. OK Python 3 TESTS 10 93 921600
327028837 sourav.codes D July 2, 2025, 5:26 a.m. OK Python 3 TESTS 10 93 921600
327025418 svrmalaviya D July 2, 2025, 4:53 a.m. OK Python 3 TESTS 10 93 921600
327171197 coderrg21 D July 3, 2025, 4:46 a.m. OK Python 3 TESTS 10 93 1024000
327175203 Basar. D July 3, 2025, 5:25 a.m. OK Python 3 TESTS 10 108 921600
327169915 0x81 D July 3, 2025, 4:31 a.m. OK Rust 2021 TESTS 10 46 0

remove filters

Back to search problems