Codeforces Round 854 by cybercats (Div. 1 + 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
1799 Codeforces Round 854 by cybercats (Div. 1 + Div. 2) FINISHED False 10800 59757863 Feb. 27, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 866 ) F Halve or Subtract PROGRAMMING brute force flows greedy sortings

B'You have an array of positive integers a_1, a_2, ldots, a_n , of length n . You are also given a positive integer b . You are allowed to perform the following operations (possibly several) times in any order: However, you must also follow these rules: The cost of an array is the sum of its elements. Find the minimum cost of a you can achieve by performing these operations. Input consists of multiple test cases. The first line contains a single integer t , the number of test cases ( 1 <= t <= 5000 ). The first line of each test case contains n , b , k_1 , and k_2 ( 1 <= n <= 5000 , 1 <= b <= 10^9 , 0 <= k_1, k_2 <= n ). The second line of each test case contains n integers a_1, a_2, ldots, a_n describing the array a ( 1 <= a_i <= 10^9 ). It is guaranteed the sum of n over all test cases does not exceed 5000 . For each test case, print the minimum cost of a you can achieve by performing the operations. In the first test case, you can do the following: After these operations, the array is a = [5, 3, 3] has a cost 5 + 3 + 3 = 11 . We can show that this is the minimum achievable cost. In the second test case, note that we are not allowed to perform operation 1 more than once on a_1 . So it is optimal to apply operation 1 once to each a_1 and a_2 . Alternatively we could apply operation 1 only once to a_1 , since it has no effect on a_2 . In the third test case, here is one way to achieve a cost of 23 : After these operations, a = [2, 8, 3, 7, 3] . The cost of a is 2 + 8 + 3 + 7 + 3 = 23 . We can show that this is the minimum achievable cost. '...

Tutorials

Codeforces Round #854 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
195227626 Tdyx F Feb. 28, 2023, 4:20 a.m. OK C# 10 TESTS 27 295 4915200
195188868 rainboy F Feb. 27, 2023, 5:31 p.m. OK GNU C11 TESTS 27 202 200499200
195218981 liuhengxi F Feb. 28, 2023, 12:50 a.m. OK GNU C++14 TESTS 27 15 0
195180767 stkwill F Feb. 27, 2023, 4:55 p.m. OK GNU C++14 TESTS 27 15 204800
195222536 xzzduang F Feb. 28, 2023, 2:36 a.m. OK GNU C++14 TESTS 27 15 204800
195194569 sysulby F Feb. 27, 2023, 6:16 p.m. OK GNU C++14 TESTS 27 31 102400
195221944 Yamamoto_1919 F Feb. 28, 2023, 2:21 a.m. OK GNU C++14 TESTS 27 31 102400
195216679 _Diu_ F Feb. 27, 2023, 11:38 p.m. OK GNU C++14 TESTS 27 31 204800
195182333 JohnVictor F Feb. 27, 2023, 5:02 p.m. OK GNU C++14 TESTS 27 31 204800
195179084 yasugongshang F Feb. 27, 2023, 4:47 p.m. OK GNU C++14 TESTS 27 31 204800
195222597 howardyang F Feb. 28, 2023, 2:37 a.m. OK GNU C++14 TESTS 27 31 204800
195175430 AlternatingCurrent F Feb. 27, 2023, 4:31 p.m. OK GNU C++14 TESTS 27 31 8396800
195183817 square1001 F Feb. 27, 2023, 5:09 p.m. OK GNU C++17 TESTS 27 15 204800
195231835 -skyline- F Feb. 28, 2023, 5:36 a.m. OK GNU C++17 TESTS 27 15 409600
195187802 jumpmelon F Feb. 27, 2023, 5:27 p.m. OK GNU C++17 TESTS 27 30 204800
195196867 Sugar0612 F Feb. 27, 2023, 6:35 p.m. OK GNU C++17 TESTS 27 31 0
195175028 craborac F Feb. 27, 2023, 4:29 p.m. OK GNU C++17 TESTS 27 31 102400
195186499 hank55663 F Feb. 27, 2023, 5:21 p.m. OK GNU C++17 TESTS 27 31 102400
195229425 uwu F Feb. 28, 2023, 4:55 a.m. OK GNU C++17 TESTS 27 31 204800
195225972 superguymj F Feb. 28, 2023, 3:46 a.m. OK GNU C++17 TESTS 27 31 204800
195183532 AliShahali1382 F Feb. 27, 2023, 5:07 p.m. OK GNU C++17 TESTS 27 31 204800
195229933 simiao1986 F Feb. 28, 2023, 5:03 a.m. OK GNU C++17 TESTS 27 31 204800
195214365 frokaikan F Feb. 27, 2023, 10:37 p.m. OK GNU C++17 (64) TESTS 27 15 0
195213244 MarcosK F Feb. 27, 2023, 10:13 p.m. OK GNU C++17 (64) TESTS 27 15 102400
195205523 trainwithoutpain F Feb. 27, 2023, 8:13 p.m. OK GNU C++17 (64) TESTS 27 15 102400
195227841 lqx2005 F Feb. 28, 2023, 4:24 a.m. OK GNU C++17 (64) TESTS 27 15 204800
195180841 Nyaan F Feb. 27, 2023, 4:55 p.m. OK GNU C++17 (64) TESTS 27 15 204800
195188246 Toxtricity F Feb. 27, 2023, 5:28 p.m. OK GNU C++17 (64) TESTS 27 15 409600
195184667 Laurie F Feb. 27, 2023, 5:13 p.m. OK GNU C++17 (64) TESTS 27 15 512000
195227531 CE_WA_TLE F Feb. 28, 2023, 4:18 a.m. OK GNU C++17 (64) TESTS 27 15 15974400
195179776 Sana F Feb. 27, 2023, 4:50 p.m. OK GNU C++17 (64) TESTS 27 30 102400
195179630 Siberian F Feb. 27, 2023, 4:49 p.m. OK GNU C++17 (64) TESTS 27 31 0
195201483 lis05 F Feb. 27, 2023, 7:22 p.m. OK GNU C++20 (64) TESTS 27 0 307200
195225259 jinmingli F Feb. 28, 2023, 3:36 a.m. OK GNU C++20 (64) TESTS 27 15 0
195204732 __sleep F Feb. 27, 2023, 8:02 p.m. OK GNU C++20 (64) TESTS 27 15 0
195204703 __sleep F Feb. 27, 2023, 8:01 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195194554 SSerxhs F Feb. 27, 2023, 6:16 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195192226 stepanov.aa F Feb. 27, 2023, 6:02 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195187509 SorahISA F Feb. 27, 2023, 5:25 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195182224 ecnerwala F Feb. 27, 2023, 5:01 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195178600 Chtholly-Nota-Seniorious F Feb. 27, 2023, 4:45 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195178468 Golovanov399 F Feb. 27, 2023, 4:44 p.m. OK GNU C++20 (64) TESTS 27 15 102400
195185197 FastFreeTask F Feb. 27, 2023, 5:15 p.m. OK Kotlin 1.6 TESTS 27 857 921600
195184856 Egor F Feb. 27, 2023, 5:13 p.m. OK Rust 2021 TESTS 27 46 409600

remove filters

Back to search problems