Codeforces Round 1108 (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
2246 Codeforces Round 1108 (Div. 2) FINISHED False 8100 2733884 July 12, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2987 ) D diss_quack and Array Game PROGRAMMING bitmasks brute force games greedy

You are given an array (a) of (n) integers. Alice and Bob will play a game with this array. Before the game with Bob starts, Alice can increment any element of the array any number of times, each increment taking one move. One increment consists of a single addition by (1) to one index. After that, the game starts and Bob and Alice take turns, with Bob making the first move. On Bob's turn, he can choose any two indices (i) and (j) and swap the array elements at these indices (note that Bob may choose (i = j), in which case the array remains unchanged after the swap). On Alice's turn, if (a_1) is even, she finds the largest (j \leq |a|) such that (a_i) is even for all (i \leq j,) then sets (a_i := a_i/2) for (i \leq j.) Otherwise she sets (a_1 := a_1 - 1.) If any element becomes zero, it automatically gets erased from the array (and the other elements are re-indexed accordingly). The game ends when the array is empty. Alice wants to minimize the number of moves she makes, while Bob wants to maximize the number of moves Alice makes. Note that the number of moves is the sum of the number of initial additions and the number of turns Alice plays after. How many moves will Alice make with optimal play? 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 10^5)) — the length of the array. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_{n}\,(1 \le a_i \le 10^5)) — the elements of the array. It is guaranteed that the sum of (n) over all test cases does not exceed (10^5). For each test case, output a single integer — the number of moves Alice will make if both players play optimally. In the first case, Alice chooses not to add to any element initially. On the first move, Bob cho

Tutorials

Codeforces Round 1108 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
382295558 sronak D July 12, 2026, 4:42 p.m. OK C# 13 TESTS 20 250 3891200
382331505 alz D July 13, 2026, 12:49 a.m. OK C++17 (GCC 7-32) TESTS 20 62 1228800
382294260 Shakshyam D July 12, 2026, 4:38 p.m. OK C++17 (GCC 7-32) TESTS 20 62 1228800
382294414 dbg_8 D July 12, 2026, 4:38 p.m. OK C++17 (GCC 7-32) TESTS 20 62 8908800
382315423 devastator_17 D July 12, 2026, 6:59 p.m. OK C++17 (GCC 7-32) TESTS 20 78 0
382291669 ohHellNah D July 12, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 20 78 102400
382291426 FrozenSky D July 12, 2026, 4:28 p.m. OK C++17 (GCC 7-32) TESTS 20 78 8089600
382294902 Aviskar_Mvp D July 12, 2026, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 20 78 16076800
382289782 papa3 D July 12, 2026, 4:23 p.m. OK C++17 (GCC 7-32) TESTS 20 78 21094400
382322035 vadimistor D July 12, 2026, 8:23 p.m. OK C++17 (GCC 7-32) TESTS 20 78 29900800
382285855 tartarns_yan D July 12, 2026, 4:10 p.m. OK C++17 (GCC 7-32) TESTS 20 78 30515200
382297724 antguz D July 12, 2026, 4:47 p.m. OK C++20 (GCC 13-64) TESTS 20 46 1433600
382318863 dinohaur D July 12, 2026, 7:39 p.m. OK C++20 (GCC 13-64) TESTS 20 62 0
382285568 hexahydride D July 12, 2026, 4:09 p.m. OK C++20 (GCC 13-64) TESTS 20 62 2150400
382298204 anshul_ab17 D July 12, 2026, 4:48 p.m. OK C++20 (GCC 13-64) TESTS 20 62 8806400
382283306 seshiria D July 12, 2026, 4:02 p.m. OK C++20 (GCC 13-64) TESTS 20 62 9830400
382291243 matei__b D July 12, 2026, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 20 62 16486400
382295686 Sweet D July 12, 2026, 4:42 p.m. OK C++20 (GCC 13-64) TESTS 20 62 17612800
382288313 Zzzyt D July 12, 2026, 4:18 p.m. OK C++20 (GCC 13-64) TESTS 20 62 22118400
382292148 rahulprakash7033 D July 12, 2026, 4:31 p.m. OK C++20 (GCC 13-64) TESTS 20 62 36147200
382296803 piyushcool26 D July 12, 2026, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 20 62 42086400
382302539 wTzzzorz D July 12, 2026, 5:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 46 0
382295008 ARPANN D July 12, 2026, 4:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 46 16076800
382283650 dnx04 D July 12, 2026, 4:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382324999 popajop D July 12, 2026, 9:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382323197 rdx_panther D July 12, 2026, 8:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382322512 rdx_panther D July 12, 2026, 8:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382308641 xmjlove D July 12, 2026, 6:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382300581 runosake D July 12, 2026, 5:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382291575 VanshRA D July 12, 2026, 4:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
382293800 dooglius D July 12, 2026, 4:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 102400
382291428 vuthoo D July 12, 2026, 4:28 p.m. OK GNU C11 TESTS 20 187 1024000
382293027 Praket_Thakur D July 12, 2026, 4:34 p.m. OK GNU C11 TESTS 20 1187 819200
382284975 prats2853 D July 12, 2026, 4:07 p.m. OK Go TESTS 20 62 66457600
382297676 troyanorte D July 12, 2026, 4:47 p.m. OK Go TESTS 20 93 5427200
382314830 p1nk_un1c0rn D July 12, 2026, 6:51 p.m. OK Go TESTS 20 140 44544000
382290958 Squid24 D July 12, 2026, 4:27 p.m. OK Java 21 TESTS 20 265 15667200
382283849 vishu00 D July 12, 2026, 4:03 p.m. OK Java 21 TESTS 20 281 1843200
382283310 loophoel_01 D July 12, 2026, 4:02 p.m. OK Java 21 TESTS 20 296 614400
382287138 MMWARRIOR03 D July 12, 2026, 4:14 p.m. OK Java 21 TESTS 20 296 614400
382292272 anmolarcade D July 12, 2026, 4:31 p.m. OK Java 21 TESTS 20 296 36454400
382304910 hg_2005 D July 12, 2026, 5:37 p.m. OK Java 21 TESTS 20 328 1433600
382295594 callme8samay D July 12, 2026, 4:42 p.m. OK Java 21 TESTS 20 328 17817600
382298064 Sumanth14 D July 12, 2026, 4:48 p.m. OK Java 21 TESTS 20 328 35532800
382314899 shashank_om D July 12, 2026, 6:52 p.m. OK Java 21 TESTS 20 328 87347200
382328541 wddd D July 12, 2026, 10:50 p.m. OK Java 21 TESTS 20 343 13004800
382297656 charvsnnn D July 12, 2026, 4:47 p.m. OK Java 8 TESTS 20 156 9728000
382292582 Pseudoproton D July 12, 2026, 4:32 p.m. OK Java 8 TESTS 20 218 0
382286563 navaneethamera D July 12, 2026, 4:12 p.m. OK Java 8 TESTS 20 421 0
382352897 dom0619 D July 13, 2026, 5:40 a.m. OK Java 8 TESTS 20 1453 0
382292806 pin7gu D July 12, 2026, 4:33 p.m. OK Kotlin 1.7 TESTS 20 296 1433600
382283527 ayushvem8795 D July 12, 2026, 4:03 p.m. OK Kotlin 2.2 TESTS 20 171 8089600
382297439 chinesedfan D July 12, 2026, 4:47 p.m. OK Node.js TESTS 20 781 14438400
382293118 divya2212 D July 12, 2026, 4:34 p.m. OK PyPy 3 TESTS 20 281 10137600
382355493 ps2006 D July 13, 2026, 6:08 a.m. OK PyPy 3 TESTS 20 1187 10444800
382283579 EliteCoder_77 D July 12, 2026, 4:03 p.m. OK PyPy 3-64 TESTS 20 140 20377600
382292799 Sikhoo D July 12, 2026, 4:33 p.m. OK PyPy 3-64 TESTS 20 156 23449600
382283784 tranlehieu D July 12, 2026, 4:03 p.m. OK PyPy 3-64 TESTS 20 187 13414400
382300464 vaibhav25526 D July 12, 2026, 5:04 p.m. OK PyPy 3-64 TESTS 20 203 13926400
382297118 longjourney D July 12, 2026, 4:46 p.m. OK PyPy 3-64 TESTS 20 203 35840000
382297704 Aasuren D July 12, 2026, 4:47 p.m. OK PyPy 3-64 TESTS 20 218 14950400
382289756 aurabyte07 D July 12, 2026, 4:22 p.m. OK PyPy 3-64 TESTS 20 218 17100800
382287920 SandeepMoharana D July 12, 2026, 4:17 p.m. OK PyPy 3-64 TESTS 20 218 29900800
382317840 apexion D July 12, 2026, 7:26 p.m. OK PyPy 3-64 TESTS 20 234 13619200
382298648 is_it_interactive D July 12, 2026, 4:49 p.m. OK PyPy 3-64 TESTS 20 250 14438400
382295341 Dattasai001 D July 12, 2026, 4:41 p.m. OK Python 3 TESTS 20 390 19046400
382289685 iitian_coder_xyz D July 12, 2026, 4:22 p.m. OK Python 3 TESTS 20 500 37683200
382298049 ask812 D July 12, 2026, 4:48 p.m. OK Python 3 TESTS 20 890 19968000
382298691 ntenalirama D July 12, 2026, 4:49 p.m. OK Python 3 TESTS 20 906 12595200
382292049 Garv_12 D July 12, 2026, 4:30 p.m. OK Python 3 TESTS 20 937 28876800
382290756 prasad_raminen D July 12, 2026, 4:26 p.m. OK Python 3 TESTS 20 968 77209600
382298273 Arvind215271 D July 12, 2026, 4:48 p.m. OK Python 3 TESTS 20 1625 48742400
382287319 rg_abhi D July 12, 2026, 4:14 p.m. OK Python 3 TESTS 20 1671 16588800
382293778 hanchangseo D July 12, 2026, 4:36 p.m. OK Python 3 TESTS 20 1671 36044800
382352961 gooonn D July 13, 2026, 5:41 a.m. OK Python 3 TESTS 20 1687 76595200
382292632 cvs-650 D July 12, 2026, 4:32 p.m. OK Rust 2024 TESTS 20 125 0

remove filters

Back to search problems