Codeforces Round 642 (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
1353 Codeforces Round 642 (Div. 3) FINISHED False 7200 142356299 May 14, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 50373 ) B Two Arrays And Swaps PROGRAMMING greedy sortings 800

B"You are given two arrays a and b both consisting of n positive (greater than zero) integers. You are also given an integer k . In one move, you can choose two indices i and j ( 1 <= i, j <= n ) and swap a_i and b_j (i.e. a_i becomes b_j and vice versa). Note that i and j can be equal or different (in particular, swap a_2 with b_2 or swap a_3 and b_9 both are acceptable moves). Your task is to find the maximum possible sum you can obtain in the array a if you can do no more than (i.e. at most) k such moves (swaps). You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 200 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains two integers n and k ( 1 <= n <= 30; 0 <= k <= n ) -- the number of elements in a and b and the maximum number of moves you can do. The second line of the test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 30 ), where a_i is the i -th element of a . The third line of the test case contains n integers b_1, b_2, ... , b_n ( 1 <= b_i <= 30 ), where b_i is the i -th element of b . For each test case, print the answer -- the maximum possible sum you can obtain in the array a if you can do no more than (i.e. at most) k swaps. In the first test case of the example, you can swap a_1 = 1 and b_2 = 4 , so a=[4, 2] and b=[3, 1] . In the second test case of the example, you don't need to swap anything. In the third test case of the example, you can swap a_1 = 1 and b_1 = 10 , a_3 = 3 and b_3 = 10 and a_2 = 2 and b_4 = 10 , so a=[10, 10, 10, 4, 5] and b=[1, 9, 3, 2, 9] . In the fourth test case of the example, you cannot swap"...

Tutorials

Codeforces Round #642 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
81459290 jctaoo B May 26, 2020, 10:16 a.m. OK Clang++17 Diagnostics TESTS 4 46 0 800
81167991 vjudge2 B May 24, 2020, 10:50 a.m. OK Clang++17 Diagnostics TESTS 4 46 0 800
81707226 anoopjhaa B May 28, 2020, 1:01 p.m. OK Clang++17 Diagnostics TESTS 4 46 0 800
81168017 vjudge5 B May 24, 2020, 10:50 a.m. OK Clang++17 Diagnostics TESTS 4 46 0 800
80863277 vladislav_k B May 21, 2020, 2:47 p.m. OK GNU C11 TESTS 4 0 0 800
81598099 fahimalhasan2019 B May 27, 2020, 8:33 a.m. OK GNU C11 TESTS 4 15 0 800
81622471 6945064332MinhTN B May 27, 2020, 1:22 p.m. OK GNU C11 TESTS 4 15 0 800
80704024 vMashfiv B May 19, 2020, 3:31 p.m. OK GNU C11 TESTS 4 15 0 800
80797113 ak5147 B May 20, 2020, 5:56 p.m. OK GNU C11 TESTS 4 15 0 800
80810217 IMRumi B May 20, 2020, 10:54 p.m. OK GNU C11 TESTS 4 15 0 800
81036759 Ismail_1903020 B May 23, 2020, 5:38 p.m. OK GNU C11 TESTS 4 15 0 800
81097316 Banty B May 24, 2020, 6:22 a.m. OK GNU C11 TESTS 4 15 0 800
80666996 zihad1783 B May 19, 2020, 8:07 a.m. OK GNU C11 TESTS 4 15 0 800
80811700 mmascari2017 B May 21, 2020, 12:06 a.m. OK GNU C11 TESTS 4 15 204800 800
80233418 DT3264 B May 15, 2020, 2:11 p.m. OK GNU C++11 TESTS 4 0 3891200 800
80201199 vjudge4 B May 15, 2020, 7:32 a.m. OK GNU C++11 TESTS 4 0 3891200 800
81247406 harisiva07112000 B May 24, 2020, 2:14 p.m. OK GNU C++11 TESTS 4 15 0 800
81405784 Antongry B May 25, 2020, 5:15 p.m. OK GNU C++11 TESTS 4 15 0 800
81412128 Pi_PCava B May 25, 2020, 6:35 p.m. OK GNU C++11 TESTS 4 15 0 800
81433707 MVP_Harry B May 26, 2020, 3:54 a.m. OK GNU C++11 TESTS 4 15 0 800
81448925 chickencode B May 26, 2020, 7:58 a.m. OK GNU C++11 TESTS 4 15 0 800
81607526 shubham_bitsg B May 27, 2020, 10:35 a.m. OK GNU C++11 TESTS 4 15 0 800
81452234 Aris12345 B May 26, 2020, 8:40 a.m. OK GNU C++11 TESTS 4 15 0 800
81336695 OngOng B May 24, 2020, 11:35 p.m. OK GNU C++11 TESTS 4 15 0 800
81200603 alexis_icy B May 24, 2020, 1:07 p.m. OK GNU C++14 TESTS 4 15 0 800
81446718 ejoi2019medal B May 26, 2020, 7:28 a.m. OK GNU C++14 TESTS 4 15 0 800
81351208 simple2208 B May 25, 2020, 5:55 a.m. OK GNU C++14 TESTS 4 15 0 800
81664585 I-ahk1510 B May 28, 2020, 2:45 a.m. OK GNU C++14 TESTS 4 15 0 800
81639506 ts0711 B May 27, 2020, 4:32 p.m. OK GNU C++14 TESTS 4 15 0 800
81640924 aman_deep21 B May 27, 2020, 4:50 p.m. OK GNU C++14 TESTS 4 15 0 800
81631184 __the_infiltrator__ B May 27, 2020, 2:59 p.m. OK GNU C++14 TESTS 4 15 0 800
81583382 gauravdas B May 27, 2020, 5:30 a.m. OK GNU C++14 TESTS 4 15 0 800
81516099 ashwinkanchana B May 26, 2020, 3:24 p.m. OK GNU C++14 TESTS 4 15 0 800
81454983 ZBeast B May 26, 2020, 9:18 a.m. OK GNU C++14 TESTS 4 15 0 800
80153828 Rauan_Number_1 B May 14, 2020, 4:34 p.m. OK GNU C++17 TESTS 4 0 3686400 800
80232175 doroshenkoeng B May 15, 2020, 1:58 p.m. OK GNU C++17 TESTS 4 0 3891200 800
81645954 azhar.ice18 B May 27, 2020, 5:57 p.m. OK GNU C++17 TESTS 4 15 0 800
81673134 Buddhistmonk B May 28, 2020, 5:48 a.m. OK GNU C++17 TESTS 4 15 0 800
81658883 aiy12 B May 27, 2020, 11:07 p.m. OK GNU C++17 TESTS 4 15 0 800
81647403 alone_musk B May 27, 2020, 6:30 p.m. OK GNU C++17 TESTS 4 15 0 800
81631354 __the_infiltrator__ B May 27, 2020, 3 p.m. OK GNU C++17 TESTS 4 15 0 800
81558372 Abhi_Kharpal B May 26, 2020, 7:05 p.m. OK GNU C++17 TESTS 4 15 0 800
81450834 avadakedavra9132 B May 26, 2020, 8:22 a.m. OK GNU C++17 TESTS 4 15 0 800
81351542 rickystyles16 B May 25, 2020, 5:59 a.m. OK GNU C++17 TESTS 4 15 0 800
80158603 rohit_1402 B May 14, 2020, 5:03 p.m. OK GNU C++17 (64) TESTS 4 0 4300800 800
81019468 granddaifuku B May 23, 2020, 1:54 p.m. OK GNU C++17 (64) TESTS 4 15 0 800
81020931 brinto B May 23, 2020, 2:14 p.m. OK GNU C++17 (64) TESTS 4 15 0 800
81021227 besieger B May 23, 2020, 2:17 p.m. OK GNU C++17 (64) TESTS 4 15 0 800
81341253 errorgorn B May 25, 2020, 2:26 a.m. OK GNU C++17 (64) TESTS 4 15 0 800
81381451 Dgeka24 B May 25, 2020, 12:18 p.m. OK GNU C++17 (64) TESTS 4 15 0 800
81414631 peroon B May 25, 2020, 6:56 p.m. OK GNU C++17 (64) TESTS 4 15 0 800
81443858 hellcat927 B May 26, 2020, 6:48 a.m. OK GNU C++17 (64) TESTS 4 15 0 800
81583387 omkarjadhav1114 B May 27, 2020, 5:30 a.m. OK GNU C++17 (64) TESTS 4 15 0 800
81015575 saif_ruet B May 23, 2020, 12:49 p.m. OK GNU C++17 (64) TESTS 4 15 0 800
80208104 synapse B May 15, 2020, 9:09 a.m. OK Go TESTS 4 31 10649600 800
80344991 DorMOUSE-None B May 16, 2020, 12:34 p.m. OK Go TESTS 4 61 10649600 800
81432121 lamvh2812 B May 26, 2020, 3:15 a.m. OK Go TESTS 4 77 0 800
80417009 serhatgiydiren B May 16, 2020, 9:32 p.m. OK Go TESTS 4 77 10649600 800
80562808 ramesh.baskaran B May 18, 2020, 2:13 a.m. OK Haskell TESTS 4 31 13824000 800
80187331 MiltonEiji B May 15, 2020, 3:23 a.m. OK Haskell TESTS 4 31 13824000 800
80263446 Laurens B May 15, 2020, 9:07 p.m. OK Haskell TESTS 4 46 13824000 800
80281726 Srthk B May 16, 2020, 5:41 a.m. OK Java 11 TESTS 4 155 23859200 800
80277442 R3KT B May 16, 2020, 4:29 a.m. OK Java 11 TESTS 4 155 23859200 800
80204241 anhpp B May 15, 2020, 8:17 a.m. OK Java 11 TESTS 4 156 23859200 800
80182727 mphillotry B May 15, 2020, 1:17 a.m. OK Java 11 TESTS 4 156 24064000 800
80853303 chiragkaushik1 B May 21, 2020, 12:53 p.m. OK Java 11 TESTS 4 170 0 800
80160230 gavaciw522 B May 14, 2020, 5:18 p.m. OK Java 11 TESTS 4 170 23859200 800
80555795 Kimo_Fathy B May 17, 2020, 9:39 p.m. OK Java 11 TESTS 4 170 23961600 800
81148254 p_unit B May 24, 2020, 8:26 a.m. OK Java 11 TESTS 4 171 0 800
80972064 mrlol945 B May 22, 2020, 9:57 p.m. OK Java 11 TESTS 4 171 0 800
80881478 harm007 B May 21, 2020, 6:48 p.m. OK Java 11 TESTS 4 171 0 800
81611586 labdhi B May 27, 2020, 11:25 a.m. OK Java 8 TESTS 4 77 0 800
80750467 maomao_ B May 20, 2020, 7:33 a.m. OK Java 8 TESTS 4 78 0 800
80164653 ashraf101 B May 14, 2020, 6:11 p.m. OK Java 8 TESTS 4 78 20787200 800
81144177 arpan_ B May 24, 2020, 7:50 a.m. OK Java 8 TESTS 4 93 0 800
80875776 arnav_mandal B May 21, 2020, 5:25 p.m. OK Java 8 TESTS 4 93 0 800
80709568 sanbayev01 B May 19, 2020, 4:39 p.m. OK Java 8 TESTS 4 93 0 800
80269654 luchy0120 B May 16, 2020, 12:45 a.m. OK Java 8 TESTS 4 93 20787200 800
80404779 nandit B May 16, 2020, 6:20 p.m. OK Java 8 TESTS 4 93 20787200 800
80382429 vanshita B May 16, 2020, 2:55 p.m. OK Java 8 TESTS 4 93 20787200 800
80188039 Ad-007 B May 15, 2020, 3:39 a.m. OK Java 8 TESTS 4 93 20787200 800
81144089 scnucjh B May 24, 2020, 7:49 a.m. OK Kotlin TESTS 4 139 0 800
81035739 mishagam B May 23, 2020, 5:25 p.m. OK Kotlin TESTS 4 139 1126400 800
80201501 Spheniscine B May 15, 2020, 7:37 a.m. OK Kotlin TESTS 4 139 22835200 800
80803845 MadMax B May 20, 2020, 7:46 p.m. OK Kotlin TESTS 4 140 0 800
80673595 om_1999 B May 19, 2020, 9:35 a.m. OK Kotlin TESTS 4 140 1126400 800
80232046 Markuuus B May 15, 2020, 1:56 p.m. OK Kotlin TESTS 4 140 21708800 800
81035736 gevmart B May 23, 2020, 5:25 p.m. OK Kotlin TESTS 4 155 0 800
81340035 a11eca B May 25, 2020, 1:47 a.m. OK Kotlin TESTS 4 155 1228800 800
80986505 taresin B May 23, 2020, 5:45 a.m. OK Kotlin TESTS 4 155 1331200 800
80524143 IsTinG B May 17, 2020, 1:34 p.m. OK Kotlin TESTS 4 155 23040000 800
80764862 Khazmadu B May 20, 2020, 10:55 a.m. OK Mono C# TESTS 4 46 3993600 800
80172480 1Tim30n3 B May 14, 2020, 8:11 p.m. OK Mono C# TESTS 4 46 8601600 800
80173948 TRR B May 14, 2020, 8:41 p.m. OK Mono C# TESTS 4 46 8601600 800
80381859 peterc B May 16, 2020, 2:52 p.m. OK Mono C# TESTS 4 46 12288000 800
80267861 pacificus B May 15, 2020, 11:26 p.m. OK Mono C# TESTS 4 46 12288000 800
80298430 sakapon B May 16, 2020, 9:16 a.m. OK Mono C# TESTS 4 61 12390400 800
80298709 sakapon B May 16, 2020, 9:19 a.m. OK Mono C# TESTS 4 61 12595200 800
81565827 pycyu B May 26, 2020, 9:33 p.m. OK Mono C# TESTS 4 62 204800 800
80293842 sakapon B May 16, 2020, 8:18 a.m. OK Mono C# TESTS 4 62 12390400 800
80729882 mariusja123 B May 19, 2020, 10:57 p.m. OK Mono C# TESTS 4 77 204800 800
80815673 Hokage. B May 21, 2020, 2:36 a.m. OK MS C++ TESTS 4 30 0 800
80293710 BaseFrame B May 16, 2020, 8:16 a.m. OK MS C++ TESTS 4 30 3891200 800
80287429 vjudge1 B May 16, 2020, 6:59 a.m. OK MS C++ TESTS 4 30 3891200 800
80441339 gao_wu_di B May 17, 2020, 6:52 a.m. OK MS C++ TESTS 4 31 3891200 800
80634456 mahreddy B May 18, 2020, 7:15 p.m. OK MS C++ 2017 TESTS 4 15 0 800
81010079 Cookie_graph B May 23, 2020, 11:31 a.m. OK MS C++ 2017 TESTS 4 15 0 800
80775491 skymin B May 20, 2020, 1:16 p.m. OK MS C++ 2017 TESTS 4 15 204800 800
80264117 aak_sah B May 15, 2020, 9:26 p.m. OK MS C++ 2017 TESTS 4 15 3686400 800
80370883 vjudge3 B May 16, 2020, 1:27 p.m. OK MS C++ 2017 TESTS 4 15 3686400 800
80292194 a.asbjoernsen B May 16, 2020, 7:58 a.m. OK MS C++ 2017 TESTS 4 15 3686400 800
80228275 vjudge1 B May 15, 2020, 1:12 p.m. OK MS C++ 2017 TESTS 4 15 3686400 800
80153117 diankao B May 14, 2020, 4:33 p.m. OK MS C++ 2017 TESTS 4 15 3686400 800
80157164 ma_da_fa_ki B May 14, 2020, 4:51 p.m. OK MS C++ 2017 TESTS 4 15 3788800 800
81057590 immortalsman B May 24, 2020, 3:24 a.m. OK MS C++ 2017 TESTS 4 30 0 800
81201361 mamme_hunter B May 24, 2020, 1:17 p.m. OK Node.js TESTS 4 77 1228800 800
80298161 pqhuy98 B May 16, 2020, 9:12 a.m. OK Node.js TESTS 4 170 15257600 800
80184647 cyborgs B May 15, 2020, 2:19 a.m. OK Node.js TESTS 4 171 13516800 800
80419179 WbxOne B May 16, 2020, 10:35 p.m. OK Node.js TESTS 4 202 13209600 800
80234152 Arturgo B May 15, 2020, 2:20 p.m. OK Ocaml TESTS 4 15 3993600 800
80179804 Khaled_Mohamed B May 14, 2020, 11:35 p.m. OK PHP TESTS 4 31 6041600 800
80246026 Yannn B May 15, 2020, 4:43 p.m. OK PHP TESTS 4 46 6041600 800
80174275 flyman3046 B May 14, 2020, 8:48 p.m. OK PyPy 2 TESTS 4 124 23347200 800
80895445 yumtam B May 22, 2020, 2:09 a.m. OK PyPy 2 TESTS 4 139 1536000 800
80164562 Devraj10 B May 14, 2020, 6:09 p.m. OK PyPy 2 TESTS 4 155 25190400 800
80165892 maheshraju2020 B May 14, 2020, 6:27 p.m. OK PyPy 3 TESTS 4 124 21606400 800
80156728 userid30 B May 14, 2020, 4:48 p.m. OK PyPy 3 TESTS 4 139 21606400 800
80962164 Nahian36 B May 22, 2020, 6:29 p.m. OK PyPy 3 TESTS 4 140 1433600 800
81529372 mihikagaonkar B May 26, 2020, 3:54 p.m. OK PyPy 3 TESTS 4 140 1536000 800
81454247 minm B May 26, 2020, 9:08 a.m. OK PyPy 3 TESTS 4 140 1740800 800
80403478 TeraFuffad B May 16, 2020, 6:05 p.m. OK PyPy 3 TESTS 4 140 21606400 800
80176091 alexanderanchishkin B May 14, 2020, 9:30 p.m. OK PyPy 3 TESTS 4 140 21606400 800
80530681 mth1908 B May 17, 2020, 2:51 p.m. OK PyPy 3 TESTS 4 140 21708800 800
80296274 vk48962713 B May 16, 2020, 8:48 a.m. OK PyPy 3 TESTS 4 140 21811200 800
80264511 Blue_Gene B May 15, 2020, 9:36 p.m. OK PyPy 3 TESTS 4 140 22937600 800
80154810 silkylaroux B May 14, 2020, 4:37 p.m. OK Python 2 TESTS 4 170 6451200 800
80158766 ap1008 B May 14, 2020, 5:04 p.m. OK Python 2 TESTS 4 171 6451200 800
81356658 Glezok B May 25, 2020, 7:09 a.m. OK Python 3 TESTS 4 92 307200 800
80195734 raunaksarda1999 B May 15, 2020, 6:15 a.m. OK Python 3 TESTS 4 92 6963200 800
80176024 NoKnowledgeGG B May 14, 2020, 9:28 p.m. OK Python 3 TESTS 4 92 6963200 800
81375816 harikabelde B May 25, 2020, 11:11 a.m. OK Python 3 TESTS 4 93 204800 800
80690021 pranitnigde B May 19, 2020, 1:06 p.m. OK Python 3 TESTS 4 93 204800 800
81693106 76ff7a B May 28, 2020, 10 a.m. OK Python 3 TESTS 4 93 307200 800
81629800 vjudge5 B May 27, 2020, 2:44 p.m. OK Python 3 TESTS 4 93 307200 800
81624164 LinLinO.O B May 27, 2020, 1:42 p.m. OK Python 3 TESTS 4 93 307200 800
81452115 chill_house B May 26, 2020, 8:39 a.m. OK Python 3 TESTS 4 93 307200 800
81361026 AKKAPELLIHARSHITH B May 25, 2020, 8:09 a.m. OK Python 3 TESTS 4 93 307200 800
81673602 BIG_OUNCE69420 B May 28, 2020, 5:54 a.m. OK Ruby TESTS 4 61 102400 800
80210605 eugene.l B May 15, 2020, 9:39 a.m. OK Ruby TESTS 4 61 6451200 800
81588866 springroll B May 27, 2020, 6:40 a.m. OK Rust TESTS 4 30 0 800
80537223 garciparedes B May 17, 2020, 4:13 p.m. OK Rust TESTS 4 30 3788800 800
81398161 pandrei B May 25, 2020, 3:35 p.m. OK Rust TESTS 4 31 0 800
81397867 pandrei B May 25, 2020, 3:31 p.m. OK Rust TESTS 4 31 0 800
80253752 one_feeble_coder B May 15, 2020, 6:24 p.m. OK Rust TESTS 4 31 3788800 800
80239949 TomazGomes B May 15, 2020, 3:27 p.m. OK Rust TESTS 4 31 3788800 800
80182148 sansen B May 15, 2020, 12:59 a.m. OK Rust TESTS 4 31 4096000 800
81388624 kihen B May 25, 2020, 1:44 p.m. OK Rust TESTS 4 46 0 800
80454002 myduomilia B May 17, 2020, 9:21 a.m. OK Rust TESTS 4 46 3788800 800

remove filters

Back to search problems