Codeforces Round 1118 (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
2258 Codeforces Round 1118 (Div. 2) FINISHED False 7200 141884 Aug. 29, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3389 ) B2 Carrot Chopdown (Hard Version) PROGRAMMING brute force implementation math

This is the hard version of the problem. The difference between the versions is that in this version, you need to solve the problem for different values of (k). You can hack only if you solved all versions of this problem. Alp loves carrots. Since he hasn't eaten lunch yet, he wants to buy a carrot salad to eat outside. However, he has a weird obsession: all the carrots must be the exact same length; otherwise, the salad doesn't look aesthetically pleasing to him. Since he is in the middle of the street and doesn't have a knife, he can't cut the carrots himself. You need to divide all the carrots using your machine and sell them to Alp. You are given (n) delicious carrots with sizes (a_1, a_2, \ldots, a_n). You are also given a cutting machine, which works as follows. For each operation, you choose a set of carrots (you can choose chopped carrots again) and a positive integer (x) (not necessarily the same for each operation) . After that, consider every chosen carrot, let its length be (l). If (l \le x), this carrot is unaffected; otherwise, it is divided into two carrots of sizes (x) and (l-x). We'll sell some of the final carrots to an interesting guy who wants them all to be the same length. We are asking you to determine the maximum number of carrots we can sell after using this machine exactly (k) times. Solve the problem for each (k = 1, 2, \ldots, m) independently . 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 (n) and (m) ((1 \le n,m \le 2 \cdot 10^5)), denoting the number of carrots and the maximum possible length of a carrot. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le m)), denoting the initial carrot sizes. It is guaranteed that the sum of (n) over all test cases does

Tutorials

Codeforces Round 1118 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
388834720 parthkumar1802 B2 Aug. 29, 2026, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 10 93 0
388852919 papesh B2 Aug. 29, 2026, 7:37 p.m. OK C++17 (GCC 7-32) TESTS 10 93 42086400
388833005 r-tron18 B2 Aug. 29, 2026, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 10 109 102400
388863450 buchuu B2 Aug. 30, 2026, 1:05 a.m. OK C++17 (GCC 7-32) TESTS 10 109 921600
388828803 saeedgx B2 Aug. 29, 2026, 4:19 p.m. OK C++17 (GCC 7-32) TESTS 10 109 921600
388821170 11dutta B2 Aug. 29, 2026, 3:56 p.m. OK C++17 (GCC 7-32) TESTS 10 109 921600
388866583 yyc000123 B2 Aug. 30, 2026, 3 a.m. OK C++17 (GCC 7-32) TESTS 10 109 2457600
388874556 pranay128_ B2 Aug. 30, 2026, 5:51 a.m. OK C++17 (GCC 7-32) TESTS 10 109 2560000
388832276 zzzura B2 Aug. 29, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 10 109 2560000
388819525 adarsh_singh23 B2 Aug. 29, 2026, 3:52 p.m. OK C++17 (GCC 7-32) TESTS 10 109 2560000
388867161 Nyans2022 B2 Aug. 30, 2026, 3:16 a.m. OK C++20 (GCC 13-64) TESTS 10 62 4096000
388826756 Beyound_Singularity B2 Aug. 29, 2026, 4:13 p.m. OK C++20 (GCC 13-64) TESTS 10 62 5632000
388832638 lfreecs B2 Aug. 29, 2026, 4:30 p.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
388831665 fahimquicklife8 B2 Aug. 29, 2026, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
388831474 Materialist B2 Aug. 29, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 10 78 102400
388869598 chechau B2 Aug. 30, 2026, 4:17 a.m. OK C++20 (GCC 13-64) TESTS 10 78 921600
388833884 Sergey2006 B2 Aug. 29, 2026, 4:33 p.m. OK C++20 (GCC 13-64) TESTS 10 78 921600
388870669 ZZ_pp B2 Aug. 30, 2026, 4:40 a.m. OK C++20 (GCC 13-64) TESTS 10 78 1024000
388822898 cristinaoo1 B2 Aug. 29, 2026, 4:01 p.m. OK C++20 (GCC 13-64) TESTS 10 78 1024000
388820607 meow930908 B2 Aug. 29, 2026, 3:55 p.m. OK C++20 (GCC 13-64) TESTS 10 78 1024000
388854071 Aa_k B2 Aug. 29, 2026, 7:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 68812800
388872344 xXGreninjaXx_7 B2 Aug. 30, 2026, 5:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
388865889 I-KNOWBUDDY B2 Aug. 30, 2026, 2:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
388866549 TempestArchon B2 Aug. 30, 2026, 2:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 102400
388851413 ballast666 B2 Aug. 29, 2026, 7:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 102400
388851267 ballast666 B2 Aug. 29, 2026, 7:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 102400
388858839 VanVecten B2 Aug. 29, 2026, 9:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 204800
388861125 mitesh_1 B2 Aug. 29, 2026, 11:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 2662400
388837188 MartinRT B2 Aug. 29, 2026, 4:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 2662400
388829063 Redpanda_x B2 Aug. 29, 2026, 4:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 2662400
388831609 ruban B2 Aug. 29, 2026, 4:27 p.m. OK FPC TESTS 10 718 3276800
388830760 Sparta_ B2 Aug. 29, 2026, 4:25 p.m. OK Go TESTS 10 218 7884800
388821494 CMMMH B2 Aug. 29, 2026, 3:57 p.m. OK Haskell TESTS 10 109 16793600
388841763 pratthu45 B2 Aug. 29, 2026, 5:43 p.m. OK Java 21 TESTS 10 250 8089600
388834609 Durgadevi_S B2 Aug. 29, 2026, 4:34 p.m. OK Java 21 TESTS 10 281 6553600
388823885 farooq.personal12 B2 Aug. 29, 2026, 4:04 p.m. OK Java 21 TESTS 10 281 9728000
388833163 SpaR021 B2 Aug. 29, 2026, 4:31 p.m. OK Java 21 TESTS 10 296 6041600
388820633 Nandini_21 B2 Aug. 29, 2026, 3:55 p.m. OK Java 21 TESTS 10 296 6451200
388834772 sanchari1729 B2 Aug. 29, 2026, 4:34 p.m. OK Java 21 TESTS 10 296 57241600
388832397 GrindUntilRed B2 Aug. 29, 2026, 4:29 p.m. OK Java 21 TESTS 10 312 8704000
388821967 Scarceflyer7 B2 Aug. 29, 2026, 3:59 p.m. OK Java 21 TESTS 10 328 7680000
388828123 yashprataps357 B2 Aug. 29, 2026, 4:17 p.m. OK Java 21 TESTS 10 343 5017600
388832389 Jeffy11 B2 Aug. 29, 2026, 4:29 p.m. OK Java 21 TESTS 10 343 6451200
388824812 Night1324 B2 Aug. 29, 2026, 4:07 p.m. OK Java 8 TESTS 10 234 15872000
388820287 Vrushali_13 B2 Aug. 29, 2026, 3:54 p.m. OK Java 8 TESTS 10 250 14643200
388821832 shruti1008 B2 Aug. 29, 2026, 3:58 p.m. OK Java 8 TESTS 10 265 13926400
388821887 CherryPick B2 Aug. 29, 2026, 3:58 p.m. OK Java 8 TESTS 10 625 14950400
388826520 incognito-unlimited B2 Aug. 29, 2026, 4:12 p.m. OK Java 8 TESTS 10 718 0
388819199 Riszzz05 B2 Aug. 29, 2026, 3:51 p.m. OK PyPy 3 TESTS 10 484 36454400
388824955 raghav13aggarwal03 B2 Aug. 29, 2026, 4:07 p.m. OK PyPy 3 TESTS 10 703 31232000
388819875 rahul_annaldas1 B2 Aug. 29, 2026, 3:52 p.m. OK PyPy 3 TESTS 10 796 51097600
388828729 hoang_minh_2k13 B2 Aug. 29, 2026, 4:18 p.m. OK PyPy 3-64 TESTS 10 140 25907200
388823868 KaveenKrithik B2 Aug. 29, 2026, 4:04 p.m. OK PyPy 3-64 TESTS 10 156 26214400
388819146 jbxeoler B2 Aug. 29, 2026, 3:50 p.m. OK PyPy 3-64 TESTS 10 156 28467200
388824879 Sagnik120 B2 Aug. 29, 2026, 4:07 p.m. OK PyPy 3-64 TESTS 10 171 30208000
388831997 aadibhav3 B2 Aug. 29, 2026, 4:28 p.m. OK PyPy 3-64 TESTS 10 187 27545600
388829423 ecubic B2 Aug. 29, 2026, 4:21 p.m. OK PyPy 3-64 TESTS 10 187 27545600
388844804 pearl62 B2 Aug. 29, 2026, 6:15 p.m. OK PyPy 3-64 TESTS 10 203 26419200
388825362 Pi213 B2 Aug. 29, 2026, 4:09 p.m. OK PyPy 3-64 TESTS 10 203 26726400
388827670 Maruzensky B2 Aug. 29, 2026, 4:15 p.m. OK PyPy 3-64 TESTS 10 203 29184000
388844740 pearl62 B2 Aug. 29, 2026, 6:15 p.m. OK PyPy 3-64 TESTS 10 218 26419200
388828922 _cicada_3301 B2 Aug. 29, 2026, 4:19 p.m. OK Python 3 TESTS 10 437 32051200
388869308 gooonn B2 Aug. 30, 2026, 4:10 a.m. OK Python 3 TESTS 10 468 33382400
388850484 shouryasharan27 B2 Aug. 29, 2026, 6:59 p.m. OK Python 3 TESTS 10 546 42496000
388824741 sm_10 B2 Aug. 29, 2026, 4:07 p.m. OK Python 3 TESTS 10 609 29900800
388824399 arpan_01574 B2 Aug. 29, 2026, 4:06 p.m. OK Python 3 TESTS 10 843 56832000
388827332 MAXX_THUNDER_001 B2 Aug. 29, 2026, 4:14 p.m. OK Python 3 TESTS 10 890 45056000
388832515 GurkhaCoder B2 Aug. 29, 2026, 4:29 p.m. OK Python 3 TESTS 10 937 36966400
388860535 RicePie B2 Aug. 29, 2026, 10:48 p.m. OK Python 3 TESTS 10 1000 42188800
388852760 cheikhghadi5 B2 Aug. 29, 2026, 7:34 p.m. OK Rust 2021 TESTS 10 62 15769600
388840918 Solalyth B2 Aug. 29, 2026, 5:34 p.m. OK Rust 2024 TESTS 10 62 19148800
388819490 cvs-650 B2 Aug. 29, 2026, 3:51 p.m. OK Rust 2024 TESTS 10 203 10342400

remove filters

Back to search problems