Codeforces Round 1048 (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
2139 Codeforces Round 1048 (Div. 2) FINISHED False 10800 19063523 Sept. 8, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20750 ) B Cake Collection PROGRAMMING greedy

Maple wants to bake some cakes for Chocola and Vanilla. One day, she discovers (n) magical cake ovens. The (i)-th oven bakes (a_i) cakes every second. The cakes remain in their respective ovens until they are collected. At the end of each second, she may teleport to any oven (including the one she is currently at) and collect all the cakes that have accumulated in that oven up to that point. Your task is to determine the maximum number of cakes Maple can collect in (m) seconds. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((1 \leq n \leq 10^5), (1\leq m\leq 10^8)) — the number of magical ovens and the number of seconds during which Maple will collect cakes. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \leq a_i \le 10^5)) — the number of cakes the (i)-th oven bakes every second. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single integer representing the maximum number of cakes Maple can collect in (m) seconds. For the first test case, one optimal solution is as follows: At the end of the first second, the ovens contain (1), (2), and (3) cakes respectively. Maple teleports to oven (3) and collects all (3) cakes. Oven (3) now has (0) cakes remaining. At the end of the second second, the ovens contain (2), (4), and (3) cakes respectively. Maple teleports to oven (1) and collects all (2) cakes. Oven (1) now has (0) cakes remaining. At the end of the third second, the ovens contain (1), (6), and (6) cakes respectively. Maple teleports to oven (2) and collects all (6) cakes. Oven (2) now has (0) cakes remaining. At the end of

Tutorials

Codeforces Round 1048 (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
337705677 og.kostya B Sept. 9, 2025, 6:02 a.m. OK C# 10 TESTS 10 109 1433600
337705648 og.kostya B Sept. 9, 2025, 6:02 a.m. OK C# 13 TESTS 10 155 1331200
337688903 mdsaifulislamjakaria B Sept. 9, 2025, 2:01 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
337688747 5aiful B Sept. 9, 2025, 1:58 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
337700795 jonas_martha_27 B Sept. 9, 2025, 5:02 a.m. OK C++17 (GCC 7-32) TESTS 10 78 0
337700713 kajuu B Sept. 9, 2025, 5:01 a.m. OK C++17 (GCC 7-32) TESTS 10 78 0
337699297 Basbosa_O B Sept. 9, 2025, 4:40 a.m. OK C++17 (GCC 7-32) TESTS 10 78 0
337685833 nk.az B Sept. 9, 2025, 1:01 a.m. OK C++17 (GCC 7-32) TESTS 10 78 0
337703835 temporary__ B Sept. 9, 2025, 5:40 a.m. OK C++17 (GCC 7-32) TESTS 10 92 102400
337652592 psi241 B Sept. 8, 2025, 5:09 p.m. OK C++17 (GCC 7-32) TESTS 10 92 102400
337684837 accuber B Sept. 9, 2025, 12:38 a.m. OK C++17 (GCC 7-32) TESTS 10 92 8089600
337704826 huangqr B Sept. 9, 2025, 5:52 a.m. OK C++17 (GCC 7-32) TESTS 10 93 0
337702766 Sachin128 B Sept. 9, 2025, 5:26 a.m. OK C++20 (GCC 13-64) TESTS 10 62 0
337695005 sif_69 B Sept. 9, 2025, 3:34 a.m. OK C++20 (GCC 13-64) TESTS 10 62 0
337687495 Jatin_Raghav B Sept. 9, 2025, 1:35 a.m. OK C++20 (GCC 13-64) TESTS 10 62 0
337705080 ishaqsharif B Sept. 9, 2025, 5:55 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337705070 hshhh_ B Sept. 9, 2025, 5:55 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337704554 maks.sidorenko B Sept. 9, 2025, 5:49 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337701560 MaulikAdhyaru B Sept. 9, 2025, 5:12 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337701541 yell_ B Sept. 9, 2025, 5:12 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337700724 pranshumg B Sept. 9, 2025, 5:01 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337698717 ZengZhaoGan_124 B Sept. 9, 2025, 4:32 a.m. OK C++20 (GCC 13-64) TESTS 10 77 0
337705215 Jashan10001 B Sept. 9, 2025, 5:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337704696 ashishranjan7868 B Sept. 9, 2025, 5:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337702956 dishsoap B Sept. 9, 2025, 5:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337702817 maryam_abdelhady_ B Sept. 9, 2025, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337702666 __grind B Sept. 9, 2025, 5:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337701178 ovien.YANG B Sept. 9, 2025, 5:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337700502 LazLooz B Sept. 9, 2025, 4:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337699757 hei_yu_bai B Sept. 9, 2025, 4:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337698531 krator10 B Sept. 9, 2025, 4:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337698448 Enryue B Sept. 9, 2025, 4:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 77 0
337694973 karma25 B Sept. 9, 2025, 3:33 a.m. OK GNU C11 TESTS 10 92 512000
337657945 Ehsan_Kabir001 B Sept. 8, 2025, 5:26 p.m. OK GNU C11 TESTS 10 93 409600
337650374 not_perma B Sept. 8, 2025, 5:03 p.m. OK GNU C11 TESTS 10 93 716800
337646596 lloydroshan_007 B Sept. 8, 2025, 4:52 p.m. OK GNU C11 TESTS 10 108 512000
337645789 pokpong007 B Sept. 8, 2025, 4:50 p.m. OK GNU C11 TESTS 10 108 819200
337686449 Joe2357 B Sept. 9, 2025, 1:15 a.m. OK GNU C11 TESTS 10 108 921600
337649499 HedgeOwen B Sept. 8, 2025, 5 p.m. OK GNU C11 TESTS 10 109 409600
337646001 Akshith_28 B Sept. 8, 2025, 4:51 p.m. OK GNU C11 TESTS 10 109 819200
337675354 2405122_Rajdip_Deb B Sept. 8, 2025, 8:42 p.m. OK GNU C11 TESTS 10 109 921600
337645410 KillerKowser B Sept. 8, 2025, 4:49 p.m. OK GNU C11 TESTS 10 343 819200
337678499 ParthSingla B Sept. 8, 2025, 9:43 p.m. OK Java 21 TESTS 10 265 614400
337646782 ManishNemade190 B Sept. 8, 2025, 4:53 p.m. OK Java 21 TESTS 10 280 1536000
337688748 lupunish B Sept. 9, 2025, 1:58 a.m. OK Java 21 TESTS 10 281 512000
337688758 sulabhambule B Sept. 9, 2025, 1:59 a.m. OK Java 21 TESTS 10 281 716800
337705096 Spencer1s B Sept. 9, 2025, 5:55 a.m. OK Java 21 TESTS 10 296 307200
337668671 vineetiwari B Sept. 8, 2025, 7:21 p.m. OK Java 21 TESTS 10 296 512000
337668164 vineetiwari B Sept. 8, 2025, 7:16 p.m. OK Java 21 TESTS 10 296 716800
337645850 Abhishek_singh_ B Sept. 8, 2025, 4:50 p.m. OK Java 21 TESTS 10 296 716800
337677482 WrongAnswerOnTestCase2 B Sept. 8, 2025, 9:20 p.m. OK Java 21 TESTS 10 296 819200
337647594 Shrovitz B Sept. 8, 2025, 4:55 p.m. OK Java 21 TESTS 10 312 716800
337668407 tani_2004 B Sept. 8, 2025, 7:18 p.m. OK Java 8 TESTS 10 156 0
337657277 tabseer B Sept. 8, 2025, 5:24 p.m. OK Java 8 TESTS 10 187 0
337655641 Him_anshu10 B Sept. 8, 2025, 5:19 p.m. OK Java 8 TESTS 10 233 2969600
337696087 arulanandh98 B Sept. 9, 2025, 3:50 a.m. OK Java 8 TESTS 10 406 0
337648295 2004gaganpandey B Sept. 8, 2025, 4:57 p.m. OK Java 8 TESTS 10 406 0
337702299 Kartikey_09 B Sept. 9, 2025, 5:20 a.m. OK Java 8 TESTS 10 421 0
337690479 yallavamsipavan B Sept. 9, 2025, 2:29 a.m. OK Java 8 TESTS 10 421 0
337668339 Kaikondar B Sept. 8, 2025, 7:17 p.m. OK Java 8 TESTS 10 421 0
337659551 samamn_varshney B Sept. 8, 2025, 5:31 p.m. OK Java 8 TESTS 10 421 0
337654691 meetsharma B Sept. 8, 2025, 5:16 p.m. OK Java 8 TESTS 10 421 0
337667634 A_23 B Sept. 8, 2025, 7:12 p.m. OK Kotlin 1.9 TESTS 10 484 11878400
337645884 vineeshd06 B Sept. 8, 2025, 4:50 p.m. OK PyPy 2 TESTS 10 249 11264000
337703761 archittect B Sept. 9, 2025, 5:39 a.m. OK PyPy 3 TESTS 10 249 11161600
337654501 Vss240301578_Hassan. B Sept. 8, 2025, 5:15 p.m. OK PyPy 3 TESTS 10 265 12492800
337676078 pTaran17 B Sept. 8, 2025, 8:54 p.m. OK PyPy 3 TESTS 10 281 13209600
337654674 siddheart2209 B Sept. 8, 2025, 5:16 p.m. OK PyPy 3 TESTS 10 296 13516800
337686957 bpdolson B Sept. 9, 2025, 1:26 a.m. OK PyPy 3 TESTS 10 311 13312000
337700220 fuyo1622 B Sept. 9, 2025, 4:54 a.m. OK PyPy 3-64 TESTS 10 124 17408000
337678975 gardengnome B Sept. 8, 2025, 9:55 p.m. OK PyPy 3-64 TESTS 10 139 17715200
337695350 Harsh_Padsala B Sept. 9, 2025, 3:39 a.m. OK PyPy 3-64 TESTS 10 140 17920000
337688878 dvzl46 B Sept. 9, 2025, 2:01 a.m. OK PyPy 3-64 TESTS 10 140 18329600
337684669 manoharsingh2402 B Sept. 9, 2025, 12:35 a.m. OK PyPy 3-64 TESTS 10 140 18329600
337703484 jvhaooooo B Sept. 9, 2025, 5:36 a.m. OK PyPy 3-64 TESTS 10 140 18432000
337677827 Nipun_Kapoor B Sept. 8, 2025, 9:28 p.m. OK PyPy 3-64 TESTS 10 140 18534400
337667471 MJavad B Sept. 8, 2025, 7:11 p.m. OK PyPy 3-64 TESTS 10 140 18534400
337659504 leiwuhoo B Sept. 8, 2025, 5:31 p.m. OK PyPy 3-64 TESTS 10 140 18534400
337702980 XVETV8 B Sept. 9, 2025, 5:29 a.m. OK PyPy 3-64 TESTS 10 140 18944000
337650761 XemM B Sept. 8, 2025, 5:04 p.m. OK Python 3 TESTS 10 156 16486400
337692761 mxq B Sept. 9, 2025, 3:03 a.m. OK Python 3 TESTS 10 171 15257600
337667899 animeshsingh38 B Sept. 8, 2025, 7:14 p.m. OK Python 3 TESTS 10 171 15257600
337645374 SaiVivekMulukuri B Sept. 8, 2025, 4:49 p.m. OK Python 3 TESTS 10 171 15257600
337652365 31N B Sept. 8, 2025, 5:09 p.m. OK Python 3 TESTS 10 171 15462400
337650348 Swapnilpatel B Sept. 8, 2025, 5:03 p.m. OK Python 3 TESTS 10 171 21196800
337650408 UjjwalTomar0808 B Sept. 8, 2025, 5:03 p.m. OK Python 3 TESTS 10 186 11980800
337645263 ibr-abd B Sept. 8, 2025, 4:49 p.m. OK Python 3 TESTS 10 187 12390400
337656964 sanjayreddyk07 B Sept. 8, 2025, 5:23 p.m. OK Python 3 TESTS 10 187 15667200
337666975 BlackFlag313 B Sept. 8, 2025, 7:07 p.m. OK Python 3 TESTS 10 187 16384000
337648288 ranjan.gyan B Sept. 8, 2025, 4:57 p.m. OK Ruby 3 TESTS 10 483 17817600
337678247 Ckiddo B Sept. 8, 2025, 9:38 p.m. OK Rust 2021 TESTS 10 77 4300800
337686404 alexis_g_alba B Sept. 9, 2025, 1:14 a.m. OK Rust 2024 TESTS 10 46 614400

remove filters

Back to search problems