Codeforces Round 979 (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
2030 Codeforces Round 979 (Div. 2) FINISHED False 8100 47058923 Oct. 19, 2024, 2:05 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 27546 ) A A Gift From Orangutan PROGRAMMING brute force dfs and similar greedy sortings

While exploring the jungle, you have bumped into a rare orangutan with a bow tie! You shake hands with the orangutan and offer him some food and water. In return... The orangutan has gifted you an array (a) of length (n). Using (a), you will construct two arrays (b) and (c), both containing (n) elements, in the following manner: (b_i = \min(a_1, a_2, \ldots, a_i)) for each (1 \leq i \leq n). (c_i = \max(a_1, a_2, \ldots, a_i)) for each (1 \leq i \leq n). Define the score of (a) as (\sum_{i=1}^n c_i - b_i) (i.e. the sum of (c_i - b_i) over all (1 \leq i \leq n)). Before you calculate the score , you can shuffle the elements of (a) however you want. Find the maximum score that you can get if you shuffle the elements of (a) optimally. The first line contains (t) ((1 \leq t \leq 100)) — the number of test cases. The first line of each test case contains an integer (n) ((1 \leq n \leq 1000)) — the number of elements in (a). The following line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \leq a_i \leq 1000)) — the elements of the array (a). It is guaranteed that the sum of (n) over all test cases does not exceed (1000). For each test case, output the maximum score that you can get. In the first test case, there is no other way to rearrange (a). So, (b = 69) and (c = 69). The only possible score is (69 - 69 = 0). In the second test case, you can rearrange (a) as (7, 5, 6). Here, (b = 7, 5, 5) and (c = 7, 7, 7). The score in this case is ((7 - 7) + (7 - 5) + (7 - 5) = 4). It can be shown this is the maximum possible score .

Tutorials

Codeforces Round 979 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
286856488 petrenslavik A Oct. 19, 2024, 11:50 p.m. OK C# 10 TESTS 4 78 0
286861124 JustForFun. A Oct. 20, 2024, 2:08 a.m. OK C# 10 TESTS 4 93 0
286824459 Zeyad_Farag A Oct. 19, 2024, 5:17 p.m. OK C# 10 TESTS 4 93 0
286817985 Adnane2003 A Oct. 19, 2024, 4:18 p.m. OK C# 10 TESTS 4 93 0
286860619 JustForFun. A Oct. 20, 2024, 1:57 a.m. OK C# 10 TESTS 4 93 0
286871647 slavik-mozhet A Oct. 20, 2024, 4:48 a.m. OK C# 10 TESTS 4 93 204800
286862217 aczzzccc A Oct. 20, 2024, 2:30 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
286833702 LelouchViBritannia_007 A Oct. 19, 2024, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
286825654 LHaoooo A Oct. 19, 2024, 5:23 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
286870816 swarup_17 A Oct. 20, 2024, 4:38 a.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286878064 za11 A Oct. 20, 2024, 5:49 a.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286874997 Shuvo2023 A Oct. 20, 2024, 5:24 a.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286862465 FWhiteMoS A Oct. 20, 2024, 2:36 a.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286859570 Anoop_Singh1 A Oct. 20, 2024, 1:32 a.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286856898 heliomm A Oct. 20, 2024, 12:06 a.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286843723 pareekutkarsh04 A Oct. 19, 2024, 7:53 p.m. OK C++17 (GCC 7-32) TESTS 4 30 102400
286840269 shade-space A Oct. 19, 2024, 7:15 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
286869909 EmmanuelRojas Duquee A Oct. 20, 2024, 4:27 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
286864050 AdnanZaman A Oct. 20, 2024, 3:03 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
286859729 badruzzamannafiz A Oct. 20, 2024, 1:37 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
286857537 Ayalla A Oct. 20, 2024, 12:31 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
286857521 Youssef_Sobhy A Oct. 20, 2024, 12:30 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
286831719 dhruv_singh1 A Oct. 19, 2024, 6:02 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
286870250 kaustub03 A Oct. 20, 2024, 4:31 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
286873916 fabulo A Oct. 20, 2024, 5:14 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
286870301 ZeusMasterD3000 A Oct. 20, 2024, 4:32 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
286859657 fffff_mela A Oct. 20, 2024, 1:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
286858459 Jorge_Slime A Oct. 20, 2024, 1:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
286870317 meetanupam A Oct. 20, 2024, 4:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
286859226 i_am_saurav10 A Oct. 20, 2024, 1:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
286826961 abhayverma1 A Oct. 19, 2024, 5:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
286823639 FanomYT A Oct. 19, 2024, 5:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
286863893 aremes95 A Oct. 20, 2024, 3:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
286868248 bhanu22600 A Oct. 20, 2024, 4:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
286866434 StarInShadow A Oct. 20, 2024, 3:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
286868298 sskumarcp A Oct. 20, 2024, 4:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
286871733 Brackets12 A Oct. 20, 2024, 4:49 a.m. OK FPC TESTS 4 46 102400
286838429 Gvs_2007 A Oct. 19, 2024, 6:57 p.m. OK GNU C11 TESTS 4 30 0
286815433 fuchsia_wn A Oct. 19, 2024, 4:13 p.m. OK GNU C11 TESTS 4 31 0
286842092 aarshverma.2006 A Oct. 19, 2024, 7:35 p.m. OK GNU C11 TESTS 4 31 0
286829042 shikhar789 A Oct. 19, 2024, 5:43 p.m. OK GNU C11 TESTS 4 31 0
286876760 naimur.ru.cse A Oct. 20, 2024, 5:39 a.m. OK GNU C11 TESTS 4 46 0
286868703 alhossainaoyon A Oct. 20, 2024, 4:12 a.m. OK GNU C11 TESTS 4 46 0
286862546 iamiftakher46 A Oct. 20, 2024, 2:37 a.m. OK GNU C11 TESTS 4 46 0
286813247 venkyaman18 A Oct. 19, 2024, 4:08 p.m. OK GNU C11 TESTS 4 61 0
286836283 Mahid A Oct. 19, 2024, 6:37 p.m. OK GNU C11 TESTS 4 62 0
286876096 say_yas A Oct. 20, 2024, 5:33 a.m. OK Java 21 TESTS 4 171 409600
286823662 keshav_.agg A Oct. 19, 2024, 5:13 p.m. OK Java 21 TESTS 4 186 716800
286872756 saikreddy A Oct. 20, 2024, 5:01 a.m. OK Java 21 TESTS 4 202 0
286850821 whotookmyname A Oct. 19, 2024, 9:31 p.m. OK Java 21 TESTS 4 202 512000
286823157 dineshchandran311 A Oct. 19, 2024, 5:10 p.m. OK Java 21 TESTS 4 217 409600
286878042 devanshpersonalll A Oct. 20, 2024, 5:49 a.m. OK Java 21 TESTS 4 218 0
286860313 udaygupta8899 A Oct. 20, 2024, 1:51 a.m. OK Java 21 TESTS 4 218 0
286832812 roydurgesh A Oct. 19, 2024, 6:11 p.m. OK Java 21 TESTS 4 218 204800
286812364 sujalsharma_13 A Oct. 19, 2024, 4:06 p.m. OK Java 21 TESTS 4 218 204800
286874990 anweshaban21 A Oct. 20, 2024, 5:24 a.m. OK Java 21 TESTS 4 218 307200
286825040 Vedant_Borkar A Oct. 19, 2024, 5:20 p.m. OK Java 8 TESTS 4 124 0
286879247 2200030476 A Oct. 20, 2024, 5:59 a.m. OK Java 8 TESTS 4 155 0
286877408 Venommm A Oct. 20, 2024, 5:44 a.m. OK Java 8 TESTS 4 155 0
286859642 sandesh543 A Oct. 20, 2024, 1:35 a.m. OK Java 8 TESTS 4 155 0
286845099 Ashutosh..y A Oct. 19, 2024, 8:10 p.m. OK Java 8 TESTS 4 155 0
286837415 navneetshriwastav A Oct. 19, 2024, 6:47 p.m. OK Java 8 TESTS 4 155 0
286836170 ankeshgupta A Oct. 19, 2024, 6:36 p.m. OK Java 8 TESTS 4 155 0
286842876 ishurajora_23 A Oct. 19, 2024, 7:44 p.m. OK Java 8 TESTS 4 156 0
286837784 navneet_shriwastav A Oct. 19, 2024, 6:50 p.m. OK Java 8 TESTS 4 156 0
286839992 Hekar_2266 A Oct. 19, 2024, 7:12 p.m. OK Java 8 TESTS 4 171 0
286848449 The1nOnly A Oct. 19, 2024, 8:53 p.m. OK Kotlin 1.9 TESTS 4 140 0
286826352 Krantzy A Oct. 19, 2024, 5:28 p.m. OK Kotlin 1.9 TESTS 4 171 0
286875030 BytesizeGenius A Oct. 20, 2024, 5:24 a.m. OK PyPy 3 TESTS 4 92 1638400
286836292 ultra_viz A Oct. 19, 2024, 6:37 p.m. OK PyPy 3 TESTS 4 93 0
286829205 Coderash05 A Oct. 19, 2024, 5:44 p.m. OK PyPy 3 TESTS 4 93 1228800
286831189 Sovi_11 A Oct. 19, 2024, 5:58 p.m. OK PyPy 3 TESTS 4 93 1331200
286824936 Awsoemio A Oct. 19, 2024, 5:19 p.m. OK PyPy 3 TESTS 4 93 1536000
286838470 bengold10 A Oct. 19, 2024, 6:57 p.m. OK PyPy 3-64 TESTS 4 62 102400
286859144 szpu_ark A Oct. 20, 2024, 1:22 a.m. OK PyPy 3-64 TESTS 4 62 1228800
286846378 AryanGoel575 A Oct. 19, 2024, 8:27 p.m. OK PyPy 3-64 TESTS 4 77 0
286840005 JCrossover_14 A Oct. 19, 2024, 7:12 p.m. OK PyPy 3-64 TESTS 4 77 0
286827769 Azimjonm2333 A Oct. 19, 2024, 5:34 p.m. OK PyPy 3-64 TESTS 4 77 0
286824467 _NITHINREDDY A Oct. 19, 2024, 5:17 p.m. OK PyPy 3-64 TESTS 4 77 0
286823504 YhuanDebeste A Oct. 19, 2024, 5:12 p.m. OK PyPy 3-64 TESTS 4 77 0
286812689 AdityaPrakash_icp A Oct. 19, 2024, 4:06 p.m. OK PyPy 3-64 TESTS 4 77 0
286824504 gardengnome A Oct. 19, 2024, 5:17 p.m. OK PyPy 3-64 TESTS 4 77 1024000
286875781 drk696 A Oct. 20, 2024, 5:31 a.m. OK PyPy 3-64 TESTS 4 77 1126400
286842446 Saadeteen A Oct. 19, 2024, 7:39 p.m. OK Python 3 TESTS 4 46 0
286879095 Aravindreddy45 A Oct. 20, 2024, 5:58 a.m. OK Python 3 TESTS 4 61 0
286850126 slk12slk A Oct. 19, 2024, 9:18 p.m. OK Python 3 TESTS 4 61 0
286836893 yohohohoho A Oct. 19, 2024, 6:42 p.m. OK Python 3 TESTS 4 61 0
286815558 reshma04 A Oct. 19, 2024, 4:13 p.m. OK Python 3 TESTS 4 61 0
286875332 yagnesh2004 A Oct. 20, 2024, 5:27 a.m. OK Python 3 TESTS 4 62 0
286875187 yagnesh2004 A Oct. 20, 2024, 5:25 a.m. OK Python 3 TESTS 4 62 0
286873941 sohamnayak A Oct. 20, 2024, 5:14 a.m. OK Python 3 TESTS 4 62 0
286872583 jaypurohit099 A Oct. 20, 2024, 4:59 a.m. OK Python 3 TESTS 4 62 0
286871622 skjtwinfamily A Oct. 20, 2024, 4:47 a.m. OK Python 3 TESTS 4 62 0
286872151 hirose2020 A Oct. 20, 2024, 4:54 a.m. OK Ruby 3 TESTS 4 265 0
286824737 YhuanDebeste A Oct. 19, 2024, 5:18 p.m. OK Ruby 3 TESTS 4 296 0
286824680 YhuanDebeste A Oct. 19, 2024, 5:18 p.m. OK Ruby 3 TESTS 4 296 0
286880128 aqwalnut A Oct. 20, 2024, 6:06 a.m. OK Rust 2021 TESTS 4 30 102400
286855631 dhruvil.d A Oct. 19, 2024, 11:22 p.m. OK Rust 2021 TESTS 4 46 0
286822606 0x81 A Oct. 19, 2024, 5:08 p.m. OK Rust 2021 TESTS 4 46 0
286829331 0x81 A Oct. 19, 2024, 5:45 p.m. OK Rust 2021 TESTS 4 62 102400

remove filters

Back to search problems