Codeforces Round 920 (Div. 3)

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
1921 Codeforces Round 920 (Div. 3) FINISHED False 8100 26493899 Jan. 15, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 21793 ) D Very Different Array PROGRAMMING greedy sortings two pointers

B"Petya has an array a_i of n integers. His brother Vasya became envious and decided to make his own array of n integers. To do this, he found m integers b_i ( m ge n ), and now he wants to choose some n integers of them and arrange them in a certain order to obtain an array c_i of length n . To avoid being similar to his brother, Vasya wants to make his array as different as possible from Petya's array. Specifically, he wants the total difference D = sum_{i=1}^{n} |a_i - c_i| to be as large as possible. Help Vasya find the maximum difference D he can obtain. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. This is followed by a description of the test cases. The first line of each test case contains two integers n and m ( 1 <= n <= m <= 2 cdot 10^5 ). The second line of each test case contains n integers a_i ( 1 <= a_i <= 10^9 ). The third line of each test case contains m integers b_i ( 1 <= b_i <= 10^9 ). It is guaranteed that in a test, the sum of m over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the maximum total difference D that can be obtained. In the first example, Vasya can, for example, create the array (1, 5, 7, 2) . Then the total difference will be D = |6-1|+|1-5|+|2-7|+|4-2| = 5+4+5+2 = 16 . In the second example, all the integers available to Vasya are equal to 1, so he can only create the array (1, 1, 1) , for which the difference D = 0 . In the third example, Vasya can, for example, create the array (5, 4, 3, 2, 1) . Then the total difference will be D = |1-5|+|2-4|+|3-3|+|4-2|+|5-1| = 4+2+0+2+4 = 12 . "...

Tutorials

Editorial for Codeforces Round 920 (Div. 3)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
241858116 volhalink D Jan. 15, 2024, 8:44 p.m. OK C# 10 TESTS 117 124 43724800
241863450 malcovic D Jan. 15, 2024, 11:19 p.m. OK C# 10 TESTS 117 139 41881600
241854979 kokora D Jan. 15, 2024, 7:52 p.m. OK C# 10 TESTS 17 140 51507200
241834157 andreyhapal D Jan. 15, 2024, 4:53 p.m. OK C# 8 TESTS 10 249 40345600
241834357 andreyhapal D Jan. 15, 2024, 4:53 p.m. OK C# 8 TESTS 10 358 40345600
241842816 NenadDapic D Jan. 15, 2024, 5:43 p.m. OK FPC TESTS 17 124 2560000
241831690 ruban D Jan. 15, 2024, 4:48 p.m. OK FPC TESTS 10 327 243916800
241883807 hangogogo D Jan. 16, 2024, 5:41 a.m. OK GNU C11 TESTS 117 140 3481600
241882801 rohitsomani D Jan. 16, 2024, 5:30 a.m. OK GNU C11 TESTS 117 171 3174400
241832060 VW100 D Jan. 15, 2024, 4:48 p.m. OK GNU C11 TESTS 117 186 9830400
241876036 UraykevoliQwQ D Jan. 16, 2024, 3:59 a.m. OK GNU C++14 TESTS 117 93 1945600
241859720 musafir_ D Jan. 15, 2024, 9:17 p.m. OK GNU C++14 TESTS 117 108 3993600
241842582 HoriaB D Jan. 15, 2024, 5:41 p.m. OK GNU C++14 TESTS 10 109 1536000
241847035 Ahmed_Nasreldeen D Jan. 15, 2024, 6:15 p.m. OK GNU C++14 TESTS 10 109 1638400
241855015 MadeInBangladesh D Jan. 15, 2024, 7:52 p.m. OK GNU C++14 TESTS 17 109 1638400
241884529 giri_27 D Jan. 16, 2024, 5:49 a.m. OK GNU C++14 TESTS 117 109 1638400
241860090 musafir_ D Jan. 15, 2024, 9:25 p.m. OK GNU C++14 TESTS 117 109 3993600
241873095 hyy_456 D Jan. 16, 2024, 3:15 a.m. OK GNU C++14 TESTS 117 109 32051200
241860529 par4dox D Jan. 15, 2024, 9:36 p.m. OK GNU C++14 TESTS 117 124 1638400
241872551 ashutoshojha1217 D Jan. 16, 2024, 3:07 a.m. OK GNU C++14 TESTS 117 124 1638400
241853204 jinsu D Jan. 15, 2024, 7:20 p.m. OK GNU C++17 TESTS 17 46 2764800
241851274 kingsneverdie1411 D Jan. 15, 2024, 6:57 p.m. OK GNU C++17 TESTS 10 78 1536000
241832838 ANKIT71S D Jan. 15, 2024, 4:49 p.m. OK GNU C++17 TESTS 10 93 3174400
241865291 zhengxinyu D Jan. 16, 2024, 12:30 a.m. OK GNU C++17 TESTS 117 108 1945600
241861822 Azzmi D Jan. 15, 2024, 10:15 p.m. OK GNU C++17 TESTS 117 108 1945600
241842379 taemie D Jan. 15, 2024, 5:40 p.m. OK GNU C++17 TESTS 10 108 2048000
241843900 check_code D Jan. 15, 2024, 5:51 p.m. OK GNU C++17 TESTS 10 108 2662400
241852001 Nour_f D Jan. 15, 2024, 7:05 p.m. OK GNU C++17 TESTS 10 108 6348800
241876133 gopala D Jan. 16, 2024, 4:01 a.m. OK GNU C++17 TESTS 117 109 1638400
241875963 Paramveer01 D Jan. 16, 2024, 3:58 a.m. OK GNU C++17 TESTS 117 109 1638400
241851578 __TRUE__ D Jan. 15, 2024, 7 p.m. OK GNU C++17 (64) TESTS 10 31 3276800
241836520 xzx_123 D Jan. 15, 2024, 5:03 p.m. OK GNU C++17 (64) TESTS 10 62 32051200
241837628 .Terist D Jan. 15, 2024, 5:09 p.m. OK GNU C++17 (64) TESTS 10 62 43315200
241843468 rafiwho D Jan. 15, 2024, 5:48 p.m. OK GNU C++17 (64) TESTS 10 77 1638400
241881710 ljjkr D Jan. 16, 2024, 5:18 a.m. OK GNU C++17 (64) TESTS 117 77 1638400
241877394 sevyy D Jan. 16, 2024, 4:20 a.m. OK GNU C++17 (64) TESTS 117 77 1638400
241840070 Na3na3a-el_shuja3a D Jan. 15, 2024, 5:23 p.m. OK GNU C++17 (64) TESTS 10 77 1638400
241835396 Oleja123 D Jan. 15, 2024, 4:58 p.m. OK GNU C++17 (64) TESTS 10 77 1638400
241836022 Mu.stafar D Jan. 15, 2024, 5:01 p.m. OK GNU C++17 (64) TESTS 10 77 1843200
241868494 LiShunSheng D Jan. 16, 2024, 1:50 a.m. OK GNU C++17 (64) TESTS 117 77 3174400
241873037 ZrjaK D Jan. 16, 2024, 3:14 a.m. OK GNU C++20 (64) TESTS 117 46 5017600
241846813 autunm_dream D Jan. 15, 2024, 6:13 p.m. OK GNU C++20 (64) TESTS 10 61 1638400
241842483 Gunter132 D Jan. 15, 2024, 5:40 p.m. OK GNU C++20 (64) TESTS 10 61 3174400
241837936 sixth_mancity_fan D Jan. 15, 2024, 5:10 p.m. OK GNU C++20 (64) TESTS 10 61 3174400
241843905 thesuaveguy D Jan. 15, 2024, 5:51 p.m. OK GNU C++20 (64) TESTS 10 61 3174400
241839610 Monazo1997 D Jan. 15, 2024, 5:21 p.m. OK GNU C++20 (64) TESTS 10 61 3174400
241883471 Athanasy D Jan. 16, 2024, 5:38 a.m. OK GNU C++20 (64) TESTS 117 62 1638400
241884324 nilesh_27 D Jan. 16, 2024, 5:46 a.m. OK GNU C++20 (64) TESTS 117 62 1638400
241876249 Caproxx_119 D Jan. 16, 2024, 4:02 a.m. OK GNU C++20 (64) TESTS 117 62 1638400
241865712 DhruvP D Jan. 16, 2024, 12:43 a.m. OK GNU C++20 (64) TESTS 117 62 1638400
241858511 _nathan_drake_ D Jan. 15, 2024, 8:51 p.m. OK Go TESTS 117 93 14745600
241835074 ajayg3059 D Jan. 15, 2024, 4:56 p.m. OK Go TESTS 10 202 6451200
241836581 mohit458 D Jan. 15, 2024, 5:03 p.m. OK Java 11 TESTS 10 311 4198400
241859742 wat2 D Jan. 15, 2024, 9:17 p.m. OK Java 11 TESTS 117 311 7372800
241833205 monukumar123 D Jan. 15, 2024, 4:49 p.m. OK Java 11 TESTS 10 326 4096000
241831454 RahulAhuja2901 D Jan. 15, 2024, 4:47 p.m. OK Java 11 TESTS 10 326 9011200
241875446 formidablechief27 D Jan. 16, 2024, 3:51 a.m. OK Java 11 TESTS 117 342 13516800
241855858 mascarade D Jan. 15, 2024, 8:06 p.m. OK Java 11 TESTS 117 389 10547200
241835841 Harwinvanak D Jan. 15, 2024, 5 p.m. OK Java 11 TESTS 10 436 5632000
241860910 Nick D Jan. 15, 2024, 9:46 p.m. OK Java 11 TESTS 117 514 12492800
241852288 abhiramkumar8780 D Jan. 15, 2024, 7:08 p.m. OK Java 11 TESTS 10 670 0
241843117 V1GYAT D Jan. 15, 2024, 5:45 p.m. OK Java 11 TESTS 10 717 0
241883264 harsh_1806 D Jan. 16, 2024, 5:35 a.m. OK Java 17 TESTS 117 249 512000
241845295 anand_mishra_ D Jan. 15, 2024, 6:02 p.m. OK Java 17 TESTS 10 295 4505600
241861673 alexklm D Jan. 15, 2024, 10:10 p.m. OK Java 17 TESTS 117 296 6860800
241846034 mihir-shinde-24 D Jan. 15, 2024, 6:07 p.m. OK Java 17 TESTS 10 311 5324800
241853394 ash_79 D Jan. 15, 2024, 7:23 p.m. OK Java 17 TESTS 17 374 10854400
241845439 Ecchi D Jan. 15, 2024, 6:03 p.m. OK Java 17 TESTS 10 436 17203200
241876833 krish1832 D Jan. 16, 2024, 4:11 a.m. OK Java 17 TESTS 117 483 12902400
241845559 Ecchi D Jan. 15, 2024, 6:04 p.m. OK Java 17 TESTS 10 529 16384000
241853242 vishal_113 D Jan. 15, 2024, 7:21 p.m. OK Java 17 TESTS 17 717 512000
241848986 aryansingh7910 D Jan. 15, 2024, 6:33 p.m. OK Java 17 TESTS 10 748 1126400
241840549 rishit164 D Jan. 15, 2024, 5:26 p.m. OK Java 21 TESTS 10 389 7168000
241867869 Bill35 D Jan. 16, 2024, 1:35 a.m. OK Java 21 TESTS 117 389 7475200
241867970 Bill35 D Jan. 16, 2024, 1:37 a.m. OK Java 21 TESTS 117 390 7782400
241875967 ND_ D Jan. 16, 2024, 3:58 a.m. OK Java 21 TESTS 117 405 5017600
241880052 860421 D Jan. 16, 2024, 4:59 a.m. OK Java 21 TESTS 117 452 17100800
241861552 Sagy13 D Jan. 15, 2024, 10:06 p.m. OK Java 21 TESTS 117 467 23961600
241873361 prakhar_30 D Jan. 16, 2024, 3:19 a.m. OK Java 21 TESTS 117 483 14643200
241879716 ChongQY D Jan. 16, 2024, 4:54 a.m. OK Java 21 TESTS 117 545 51609600
241836075 mapleKing D Jan. 15, 2024, 5:01 p.m. OK Java 21 TESTS 10 780 614400
241839763 mdarif3407 D Jan. 15, 2024, 5:22 p.m. OK Java 21 TESTS 10 857 512000
241854591 Sumitsingh7 D Jan. 15, 2024, 7:46 p.m. OK Java 8 TESTS 17 202 19456000
241839340 __SSB__ D Jan. 15, 2024, 5:19 p.m. OK Java 8 TESTS 10 233 12800000
241850760 H_B_K D Jan. 15, 2024, 6:51 p.m. OK Java 8 TESTS 10 295 16281600
241833408 ilovenandini D Jan. 15, 2024, 4:49 p.m. OK Java 8 TESTS 10 342 5427200
241832557 ilovenandini D Jan. 15, 2024, 4:49 p.m. OK Java 8 TESTS 10 358 5324800
241846922 dhrubarajghosh.7 D Jan. 15, 2024, 6:14 p.m. OK Java 8 TESTS 10 592 0
241845883 jkalvinjohn D Jan. 15, 2024, 6:06 p.m. OK Java 8 TESTS 10 623 0
241848440 zadafiya610 D Jan. 15, 2024, 6:27 p.m. OK Java 8 TESTS 10 763 0
241831513 Required D Jan. 15, 2024, 4:47 p.m. OK Java 8 TESTS 10 842 6144000
241850782 tatianyi D Jan. 15, 2024, 6:51 p.m. OK MS C++ 2017 TESTS 10 342 6451200
241854071 amit_shinde D Jan. 15, 2024, 7:39 p.m. OK MS C++ 2017 TESTS 17 358 3174400
241873795 Square_Sponge D Jan. 16, 2024, 3:25 a.m. OK MS C++ 2017 TESTS 117 358 6451200
241874001 aluckyboy D Jan. 16, 2024, 3:29 a.m. OK MS C++ 2017 TESTS 117 389 5939200
241834656 AvanSingh D Jan. 15, 2024, 4:54 p.m. OK MS C++ 2017 TESTS 10 390 1638400
241873964 aluckyboy D Jan. 16, 2024, 3:29 a.m. OK MS C++ 2017 TESTS 117 421 5939200
241864394 crapcode D Jan. 16, 2024, 12:01 a.m. OK PHP TESTS 117 218 42086400
241867137 albom45674 D Jan. 16, 2024, 1:19 a.m. OK PHP TESTS 117 483 44134400
241865327 rvronak D Jan. 16, 2024, 12:31 a.m. OK PyPy 3 TESTS 117 467 25702400
241869370 StanMarsh-SP D Jan. 16, 2024, 2:11 a.m. OK PyPy 3 TESTS 117 764 50995200
241842884 kundan_1209 D Jan. 15, 2024, 5:43 p.m. OK PyPy 3 TESTS 10 795 20992000
241842631 kingsneverdie1411 D Jan. 15, 2024, 5:42 p.m. OK PyPy 3 TESTS 10 998 31539200
241877788 231414 D Jan. 16, 2024, 4:26 a.m. OK PyPy 3-64 TESTS 117 170 32563200
241875477 ash_tech07 D Jan. 16, 2024, 3:51 a.m. OK PyPy 3-64 TESTS 117 186 37990400
241868424 mikeac D Jan. 16, 2024, 1:48 a.m. OK PyPy 3-64 TESTS 117 186 37990400
241856553 kunalseth D Jan. 15, 2024, 8:17 p.m. OK PyPy 3-64 TESTS 117 186 37990400
241848815 ramann_696 D Jan. 15, 2024, 6:31 p.m. OK PyPy 3-64 TESTS 10 186 41062400
241854951 THE_GOAT_coder D Jan. 15, 2024, 7:51 p.m. OK PyPy 3-64 TESTS 17 187 37990400
241850100 Super_Misha D Jan. 15, 2024, 6:44 p.m. OK PyPy 3-64 TESTS 10 187 39219200
241860967 siddiqur_rahman D Jan. 15, 2024, 9:47 p.m. OK PyPy 3-64 TESTS 117 187 41267200
241856469 atwitthisdoor D Jan. 15, 2024, 8:15 p.m. OK PyPy 3-64 TESTS 117 202 26624000
241883823 smrw D Jan. 16, 2024, 5:41 a.m. OK PyPy 3-64 TESTS 117 202 33587200
241841786 OLOGY D Jan. 15, 2024, 5:36 p.m. OK Python 2 TESTS 10 374 16896000
241836489 OLOGY D Jan. 15, 2024, 5:03 p.m. OK Python 2 TESTS 10 421 19968000
241837546 OLOGY D Jan. 15, 2024, 5:08 p.m. OK Python 2 TESTS 10 436 19968000
241838608 OLOGY D Jan. 15, 2024, 5:14 p.m. OK Python 2 TESTS 10 452 16896000
241838207 OLOGY D Jan. 15, 2024, 5:12 p.m. OK Python 2 TESTS 10 483 16896000
241838776 OLOGY D Jan. 15, 2024, 5:15 p.m. OK Python 2 TESTS 10 499 16896000
241854429 ayush_jhajharia D Jan. 15, 2024, 7:44 p.m. OK Python 3 TESTS 17 280 36352000
241847078 Aditya_J11 D Jan. 15, 2024, 6:15 p.m. OK Python 3 TESTS 10 295 33484800
241849490 simpsimp D Jan. 15, 2024, 6:38 p.m. OK Python 3 TESTS 10 296 31539200
241837944 barvay D Jan. 15, 2024, 5:11 p.m. OK Python 3 TESTS 10 296 31539200
241836733 barvay D Jan. 15, 2024, 5:04 p.m. OK Python 3 TESTS 10 296 31641600
241839743 Dilpreet_05 D Jan. 15, 2024, 5:21 p.m. OK Python 3 TESTS 10 311 31641600
241855108 Lala_123 D Jan. 15, 2024, 7:53 p.m. OK Python 3 TESTS 17 311 36352000
241840018 garg2023 D Jan. 15, 2024, 5:23 p.m. OK Python 3 TESTS 10 312 31641600
241833923 sayedgamall D Jan. 15, 2024, 4:51 p.m. OK Python 3 TESTS 10 326 32051200
241841736 nithin1897 D Jan. 15, 2024, 5:35 p.m. OK Python 3 TESTS 10 327 32768000
241860008 liut D Jan. 15, 2024, 9:23 p.m. OK Rust 2021 TESTS 117 46 4300800

remove filters

Back to search problems