Codeforces Round 1030 (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
2118 Codeforces Round 1030 (Div. 2) FINISHED False 7200 26666723 June 12, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 18346 ) C Make It Beautiful PROGRAMMING bitmasks greedy math

You are given an array (a) of (n) integers. We define the (\text{beauty}) of a number (x) to be the number of (1) bits in its binary representation. We define the beauty of an array to be the sum of beauties of the numbers it contains. In one operation, you can select an index (i) ((1 \le i \le n)) and increase (a_i) by (1). Find the maximum beauty of the array after doing at most (k) operations. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 5000)). The description of the test cases follows. The first line of each test case contains two integers (n) and (k) ((1 \le n \le 5000), (0 \le k \le 10^{18})) — the length of the array and the maximal number of operations. The second line of each test case contains (n) integers (a_1, a_2, \ldots a_n) ((0 \le a_i \le 10^9)) —denoting the array (a). It is guaranteed that the sum of (n) over all test cases does not exceed (5000). For each test case, output a single integer, the maximum beauty after at most (k) operations. In the first test case, (a = 0, 1, 7, 2, 4). apply the first operation at (i = 1), the new array is (a = 1, 1, 7, 2, 4) apply the second operation at (i = 4), the new array is (a = 1, 1, 7, 3, 4) In the third test case, (a = 3). Since you are not required to use exactly (k) operations, it is optimal to do none.

Tutorials

Codeforces Round 1030 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
324193387 _Equinox C June 13, 2025, 5:05 a.m. OK C# 13 TESTS 10 93 307200
324144494 og.kostya C June 12, 2025, 5:34 p.m. OK C# 13 TESTS 10 93 1536000
324197164 vayunjain.221ec164 C June 13, 2025, 5:43 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324194518 resonatingBose C June 13, 2025, 5:16 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324194485 _1625 C June 13, 2025, 5:16 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324193982 jk__s C June 13, 2025, 5:11 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324192441 rajatrajmishra C June 13, 2025, 4:56 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324189441 Aletz C June 13, 2025, 4:22 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324188746 unhdgfksb C June 13, 2025, 4:14 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324186878 pro.coder.bhai C June 13, 2025, 3:49 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324188411 Eccentric_shot C June 13, 2025, 4:09 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324197198 sunsety_qi C June 13, 2025, 5:43 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
324193238 _ReverseCoder C June 13, 2025, 5:04 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324198112 Millenialkiid C June 13, 2025, 5:52 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324196305 surplusa C June 13, 2025, 5:35 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324195573 jayeshjoshi2005 C June 13, 2025, 5:28 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324192967 susman C June 13, 2025, 5:01 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324190356 himanshu86400 C June 13, 2025, 4:33 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324186504 Lewis6314 C June 13, 2025, 3:45 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324185380 refres C June 13, 2025, 3:31 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324183861 chujian_cc C June 13, 2025, 3:09 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324183751 fredy2268277 C June 13, 2025, 3:08 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
324173089 wWwWw233 C June 12, 2025, 11:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 102400
324199177 Nader_Osama C June 13, 2025, 6:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324199090 rg_13471 C June 13, 2025, 6:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324199054 THEMAINCHARACTER21 C June 13, 2025, 6:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324198748 patilshambhavi905 C June 13, 2025, 5:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324198299 MattMurdock8 C June 13, 2025, 5:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324197733 slashTeen C June 13, 2025, 5:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324195969 manya.verma21 C June 13, 2025, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324195389 sonitraj8458 C June 13, 2025, 5:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324195823 sujalmaheshwari C June 13, 2025, 5:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
324132310 James_bond_9089 C June 12, 2025, 4:28 p.m. OK C# 8 TESTS 10 139 9011200
324149493 ruban C June 12, 2025, 6:08 p.m. OK FPC TESTS 10 281 140083200
324165088 MrWizard_574 C June 12, 2025, 8:44 p.m. OK GNU C11 TESTS 10 62 102400
324176264 lintttt C June 13, 2025, 1:06 a.m. OK GNU C11 TESTS 10 77 4096000
324168694 mzip C June 12, 2025, 9:48 p.m. OK Java 21 TESTS 10 233 716800
324181083 sulabhambule C June 13, 2025, 2:30 a.m. OK Java 21 TESTS 10 249 614400
324159930 singhdevansh024 C June 12, 2025, 7:38 p.m. OK Java 21 TESTS 10 265 819200
324192264 NpHardcore_05 C June 13, 2025, 4:54 a.m. OK Java 21 TESTS 10 265 1024000
324147748 Akshatgupta069_069 C June 12, 2025, 5:55 p.m. OK Java 21 TESTS 10 280 614400
324148401 adi_7861 C June 12, 2025, 6 p.m. OK Java 21 TESTS 10 280 5222400
324132402 Soumarya_Pal C June 12, 2025, 4:29 p.m. OK Java 21 TESTS 10 281 307200
324160770 guharoypragyayan C June 12, 2025, 7:48 p.m. OK Java 21 TESTS 10 281 716800
324198870 Ronit0211 C June 13, 2025, 5:59 a.m. OK Java 21 TESTS 10 281 921600
324132329 Shivansh_Mi C June 12, 2025, 4:29 p.m. OK Java 21 TESTS 10 296 1228800
324189931 bhishma_v2 C June 13, 2025, 4:28 a.m. OK Java 8 TESTS 10 155 0
324167920 sarthaKKharKa_18 C June 12, 2025, 9:31 p.m. OK Java 8 TESTS 10 171 1331200
324165287 xmjlove C June 12, 2025, 8:46 p.m. OK Java 8 TESTS 10 187 0
324194437 anishpati1 C June 13, 2025, 5:16 a.m. OK Java 8 TESTS 10 202 0
324186098 NischayCodes C June 13, 2025, 3:40 a.m. OK Java 8 TESTS 10 202 0
324132327 mradi C June 12, 2025, 4:29 p.m. OK Java 8 TESTS 10 217 0
324158919 not_mohith C June 12, 2025, 7:26 p.m. OK Java 8 TESTS 10 296 2150400
324135033 Baidiki C June 12, 2025, 4:33 p.m. OK Java 8 TESTS 10 311 102400
324135156 SilverBullet4869 C June 12, 2025, 4:33 p.m. OK Java 8 TESTS 10 342 102400
324198179 codexzx C June 13, 2025, 5:53 a.m. OK Java 8 TESTS 10 343 2355200
324134234 lulula C June 12, 2025, 4:32 p.m. OK PyPy 3 TESTS 10 280 5939200
324172949 coder.sy C June 12, 2025, 11:42 p.m. OK PyPy 3 TESTS 10 280 17408000
324147162 DSKroc C June 12, 2025, 5:51 p.m. OK PyPy 3 TESTS 10 312 9113600
324131349 mrvandana C June 12, 2025, 4:27 p.m. OK PyPy 3 TESTS 10 390 7884800
324135996 ekanshsingh C June 12, 2025, 4:34 p.m. OK PyPy 3 TESTS 10 405 18329600
324183190 hxu10 C June 13, 2025, 3 a.m. OK PyPy 3-64 TESTS 10 124 3379200
324141554 OAY71011 C June 12, 2025, 5:17 p.m. OK PyPy 3-64 TESTS 10 124 3891200
324141151 OAY71011 C June 12, 2025, 5:15 p.m. OK PyPy 3-64 TESTS 10 124 4096000
324167405 eugalt C June 12, 2025, 9:21 p.m. OK PyPy 3-64 TESTS 10 124 5836800
324134764 Skyblock127 C June 12, 2025, 4:32 p.m. OK PyPy 3-64 TESTS 10 124 9420800
324151108 smz.26 C June 12, 2025, 6:20 p.m. OK PyPy 3-64 TESTS 10 124 11264000
324165577 gardengnome C June 12, 2025, 8:51 p.m. OK PyPy 3-64 TESTS 10 139 3993600
324152014 voldemort__baba C June 12, 2025, 6:27 p.m. OK PyPy 3-64 TESTS 10 139 4403200
324172094 eugalt C June 12, 2025, 11:17 p.m. OK PyPy 3-64 TESTS 10 139 5939200
324171004 eugalt C June 12, 2025, 10:44 p.m. OK PyPy 3-64 TESTS 10 139 6144000
324131661 Arpitkush087 C June 12, 2025, 4:27 p.m. OK Python 2 TESTS 10 1358 6860800
324195579 titi_zzz C June 13, 2025, 5:28 a.m. OK Python 3 TESTS 10 124 5427200
324177391 cmath11 C June 13, 2025, 1:29 a.m. OK Python 3 TESTS 10 155 1228800
324132539 lakshita_123 C June 12, 2025, 4:29 p.m. OK Python 3 TESTS 10 155 1331200
324139575 JosiSol C June 12, 2025, 5:08 p.m. OK Python 3 TESTS 10 156 2048000
324154234 Shivani_02_01 C June 12, 2025, 6:49 p.m. OK Python 3 TESTS 10 187 15974400
324145535 kumarshrid06 C June 12, 2025, 5:40 p.m. OK Python 3 TESTS 10 202 6553600
324149889 VinayRajput28 C June 12, 2025, 6:11 p.m. OK Python 3 TESTS 10 217 1433600
324135868 eshanrizz4722 C June 12, 2025, 4:34 p.m. OK Python 3 TESTS 10 233 16179200
324147666 shanks_jr10 C June 12, 2025, 5:55 p.m. OK Python 3 TESTS 10 234 17817600
324176979 date727 C June 13, 2025, 1:21 a.m. OK Python 3 TESTS 10 265 1228800
324185454 BetterThanNobita C June 13, 2025, 3:32 a.m. OK Rust 2021 TESTS 10 46 102400
324149093 sousou_no_frieren C June 12, 2025, 6:05 p.m. OK Rust 2021 TESTS 10 62 0
324132990 paranoidGhost C June 12, 2025, 4:30 p.m. OK Rust 2021 TESTS 10 62 0
324133508 prudentissimus C June 12, 2025, 4:30 p.m. OK Rust 2021 TESTS 10 62 307200

remove filters

Back to search problems